ไปยังเนื้อหาหลัก

จะติดตามไฮเปอร์ลิงก์ไปยังแผ่นงานที่ซ่อนอยู่ใน Excel ได้อย่างไร

ตัวอย่างเช่นฉันมีสมุดงานซึ่งมีหลายแผ่นงานแผ่นงานหลักแผ่นแรกมีการเชื่อมโยงหลายมิติไปยังแผ่นงานอื่นและตอนนี้ฉันซ่อนแผ่นงานทั้งหมดยกเว้นแผ่นงานแรก ในกรณีนี้การเชื่อมโยงหลายมิติที่เชื่อมโยงไปยังแผ่นงานที่ซ่อนอยู่จะไม่พร้อมใช้งาน แต่คุณจะทำให้ไฮเปอร์ลิงก์เหล่านี้ทำงานสำเร็จได้อย่างไร เมื่อคุณคลิกเชื่อมโยงหลายมิติแผ่นงานที่ซ่อนอยู่ที่เชื่อมโยงจะเปิดขึ้นพร้อมกันตามภาพหน้าจอต่อไปนี้

ไฮเปอร์ลิงก์ doc ไปยังแผ่นงานที่ซ่อนอยู่ 1

ทำตามไฮเปอร์ลิงก์เพื่อเปิดแผ่นงานที่ซ่อนด้วยรหัส VBA

ทำตามไฮเปอร์ลิงก์เพื่อเปิดแผ่นงานที่ซ่อนอยู่แล้วซ่อนอีกครั้งด้วยรหัส VBA


ทำตามไฮเปอร์ลิงก์เพื่อเปิดแผ่นงานที่ซ่อนด้วยรหัส VBA

รหัส VBA ต่อไปนี้อาจช่วยให้คุณเปิดแผ่นงานที่ซ่อนอยู่เมื่อคลิกที่เชื่อมโยงหลายมิติแบบสัมพัทธ์โปรดดำเนินการดังนี้:

1. คลิกขวาที่แท็บแผ่นงานที่คุณต้องการติดตามไฮเปอร์ลิงก์ไปยังแผ่นงานที่ซ่อนอยู่จากนั้นเลือก ดูรหัส จากเมนูบริบทในป๊อปอัป Microsoft Visual Basic สำหรับแอปพลิเคชัน โปรดคัดลอกและวางรหัสต่อไปนี้ลงในโมดูลว่าง:

รหัส VBA: ทำตามไฮเปอร์ลิงก์เพื่อเปิดแผ่นงานที่ซ่อนอยู่:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updateby Extendoffice
    Application.ScreenUpdating = False
    On Error Resume Next
    If Target.Column = 1 Then
        Sheets(Target.Value).Visible = xlSheetVisible
        Sheets(Target.Value).Select
    End If
    Application.ScreenUpdating = True
End Sub

ไฮเปอร์ลิงก์ doc ไปยังแผ่นงานที่ซ่อนอยู่ 2

หมายเหตุ: ในรหัสด้านบนหมายเลข 1 ในการนี​​้ ถ้า Target.Column = 1 แล้ว สคริปต์ระบุหมายเลขคอลัมน์ที่มีไฮเปอร์ลิงก์โปรดเปลี่ยนตามความต้องการของคุณ

2. จากนั้นบันทึกและปิดหน้าต่างรหัสนี้ตอนนี้เมื่อคุณคลิกไฮเปอร์ลิงก์ที่เชื่อมโยงไปยังแผ่นงานที่ซ่อนอยู่แผ่นงานที่ซ่อนไว้จะเปิดขึ้นพร้อมกัน


ทำตามไฮเปอร์ลิงก์เพื่อเปิดแผ่นงานที่ซ่อนอยู่แล้วซ่อนอีกครั้งด้วยรหัส VBA

บางครั้งคุณต้องทำตามไฮเปอร์ลิงก์เพื่อเปิดแผ่นงานที่ซ่อนอยู่และเมื่อคุณกลับไปที่แผ่นงานต้นแบบคุณต้องการให้ซ่อนแผ่นงานที่เปิดอีกครั้ง โค้ด VBA ด้านล่างสามารถช่วยคุณได้:

1. คลิกขวาที่แท็บแผ่นงานที่คุณต้องการติดตามไฮเปอร์ลิงก์ไปยังแผ่นงานที่ซ่อนอยู่จากนั้นเลือก ดูรหัส จากเมนูบริบทในป๊อปอัป Microsoft Visual Basic สำหรับแอปพลิเคชัน โปรดคัดลอกและวางรหัสต่อไปนี้ลงในโมดูลว่าง:

รหัส VBA: ทำตามไฮเปอร์ลิงก์เพื่อเปิดแผ่นงานที่ซ่อนอยู่เมื่อย้อนกลับไปซ่อนอีกครั้ง:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
   'Updateby Extendoffice
    Application.ScreenUpdating = False
    Dim strLinkSheet As String
    If InStr(Target.Parent, "!") > 0 Then
        strLinkSheet = Left(Target.Parent, InStr(1, Target.Parent, "!") - 1)
    Else
        strLinkSheet = Target.Parent
    End If
    Sheets(strLinkSheet).Visible = True
    Sheets(strLinkSheet).Select
    Application.ScreenUpdating = True
End Sub

Private Sub Worksheet_Activate()
    On Error Resume Next
    Sheets(ActiveCell.Value2).Visible = False
End Sub

ไฮเปอร์ลิงก์ doc ไปยังแผ่นงานที่ซ่อนอยู่ 3

2. จากนั้นบันทึกโฆษณาปิดหน้าต่างโค้ดเมื่อคุณคลิกไฮเปอร์ลิงก์แผ่นงานที่ซ่อนอยู่ที่เชื่อมโยงจะเปิดขึ้นทันที แต่ถ้าคุณกลับไปที่แผ่นงานหลักที่มีไฮเปอร์ลิงก์แผ่นงานที่เปิดจะถูกซ่อนโดยอัตโนมัติ

หมายเหตุ: รหัสเหล่านี้จะใช้กับชื่อแผ่นงานที่ตรงกับข้อความไฮเปอร์ลิงก์ของคุณเท่านั้น


การสาธิต: ทำตามไฮเปอร์ลิงก์เพื่อเปิดแผ่นงานที่ซ่อนด้วยรหัส VBA

Kutools สำหรับ Excel: ด้วย Add-in ของ Excel ที่มีประโยชน์มากกว่า 300 รายการให้ทดลองใช้ฟรีโดยไม่มีข้อ จำกัด ใน 30 วัน ดาวน์โหลดและทดลองใช้ฟรีทันที!

สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

🤖 Kutools AI ผู้ช่วย: ปฏิวัติการวิเคราะห์ข้อมูลโดยยึดตาม: การดำเนินการที่ชาญฉลาด   |  สร้างรหัส  |  สร้างสูตรที่กำหนดเอง  |  วิเคราะห์ข้อมูลและสร้างแผนภูมิ  |  เรียกใช้ฟังก์ชัน Kutools...
คุณสมบัติยอดนิยม: ค้นหา เน้น หรือระบุรายการที่ซ้ำกัน   |  ลบแถวว่าง   |  รวมคอลัมน์หรือเซลล์โดยไม่สูญเสียข้อมูล   |   รอบโดยไม่มีสูตร ...
การค้นหาขั้นสูง: VLookup หลายเกณฑ์    VLookup หลายค่า  |   VLookup ข้ามหลายแผ่น   |   การค้นหาที่ไม่ชัดเจน ....
รายการแบบเลื่อนลงขั้นสูง: สร้างรายการแบบหล่นลงอย่างรวดเร็ว   |  รายการแบบหล่นลงขึ้นอยู่กับ   |  เลือกหลายรายการแบบหล่นลง ....
ผู้จัดการคอลัมน์: เพิ่มจำนวนคอลัมน์เฉพาะ  |  ย้ายคอลัมน์  |  สลับสถานะการมองเห็นของคอลัมน์ที่ซ่อนอยู่  |  เปรียบเทียบช่วงและคอลัมน์ ...
คุณสมบัติเด่น: กริดโฟกัส   |  มุมมองการออกแบบ   |   บาร์สูตรใหญ่    สมุดงานและตัวจัดการชีต   |  ห้องสมุดทรัพยากร (ข้อความอัตโนมัติ)   |  เลือกวันที่   |  รวมแผ่นงาน   |  เข้ารหัส/ถอดรหัสเซลล์    ส่งอีเมลตามรายการ   |  ซุปเปอร์ฟิลเตอร์   |   ตัวกรองพิเศษ (กรองตัวหนา/ตัวเอียง/ขีดทับ...) ...
ชุดเครื่องมือ 15 อันดับแรก12 ข้อความ เครื่องมือ (เพิ่มข้อความ, ลบอักขระ, ... )   |   50 + แผนภูมิ ประเภท (แผนภูมิ Gantt, ... )   |   40+ ใช้งานได้จริง สูตร (คำนวณอายุตามวันเกิด, ... )   |   19 การแทรก เครื่องมือ (ใส่ QR Code, แทรกรูปภาพจากเส้นทาง, ... )   |   12 การแปลง เครื่องมือ (ตัวเลขเป็นคำ, การแปลงสกุลเงิน, ... )   |   7 ผสานและแยก เครื่องมือ (แถวรวมขั้นสูง, แยกเซลล์, ... )   |   ... และอื่น ๆ

เพิ่มพูนทักษะ Excel ของคุณด้วย Kutools สำหรับ Excel และสัมผัสประสิทธิภาพอย่างที่ไม่เคยมีมาก่อน Kutools สำหรับ Excel เสนอคุณสมบัติขั้นสูงมากกว่า 300 รายการเพื่อเพิ่มประสิทธิภาพและประหยัดเวลา  คลิกที่นี่เพื่อรับคุณสมบัติที่คุณต้องการมากที่สุด...

รายละเอียด


แท็บ Office นำอินเทอร์เฟซแบบแท็บมาที่ Office และทำให้งานของคุณง่ายขึ้นมาก

  • เปิดใช้งานการแก้ไขและอ่านแบบแท็บใน Word, Excel, PowerPoint, ผู้จัดพิมพ์, Access, Visio และโครงการ
  • เปิดและสร้างเอกสารหลายรายการในแท็บใหม่ของหน้าต่างเดียวกันแทนที่จะเป็นในหน้าต่างใหม่
  • เพิ่มประสิทธิภาพการทำงานของคุณ 50% และลดการคลิกเมาส์หลายร้อยครั้งให้คุณทุกวัน!
Comments (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Not sure if I will get a response to this one, but when I click the any of my hyperlinks I get a "reference isn't valid" error.
Everything still works, I just need to click ok to continue.
Does anyone have an idea what causes this error for this code?
Thank you,
This comment was minimized by the moderator on the site
I have created many wordbook and I want to index those in one page.

N.B: My point is I want to hide all the sheets, the sheets will linked with setting picture to main page. By clicking the picture linked sheet will be shown and when I come back to the main sheet the un-hide sheet will be hidden again
This comment was minimized by the moderator on the site
I would like to use this code but only want it to apply to column A. I have other web address links in other cells which cause a problem when running this code.
This comment was minimized by the moderator on the site
My hyperlink "text" is number only, and it doesn't work...
This comment was minimized by the moderator on the site
I'm using the code on two different sheets. It works for one of about 40 hyperlinks on one sheet and it opens two of about 10 hyperlinks one she second, the sheets on the second which do open do go back into hiding when I return to the sheet. The error I get when it will not open a sheet is Run-time error"9": script out of range and the code it points me to - Sheets(strLinkSheet).Visible = True Any ideas as to what change is needed make the code work on all of the sheets? Thank you in advance.
This comment was minimized by the moderator on the site
I have used this code on two different sheets in my workbook, and in both cases it works great, except for the first hyperlink on each page. I get "Subscript out of range error" and the debugger points to the "Sheets(strLinkSheet).Visible = True" right after the "end if". Anyone else see this error? It is only on the first link on the page. (my hyperlinks are in column A, and start in row 2)
This comment was minimized by the moderator on the site
[quote]I have used this code on two different sheets in my workbook, and in both cases it works great, except for the first hyperlink on each page. I get "Subscript out of range error" and the debugger points to the "Sheets(strLinkSheet).Visible = True" right after the "end if". Anyone else see this error? It is only on the first link on the page. (my hyperlinks are in column A, and start in row 2)By HelzBelz[/quote] Sheet names can't have space like "Sheet 1". I fixed my sheet names to "Sheet1" and the error stopped.
This comment was minimized by the moderator on the site
I have a sheet that is hidden that contains a hyperlink. I would like to be able go to the hidden sheet and have it close when I go back to the original sheet. I used the code but it does not work.
This comment was minimized by the moderator on the site
I am trying to hide a sheet that has a hyperlink. I would like to be able to click on the sheet go to the hyperlink sheet and then click back to the sheet and close the hidden sheet. I have tried your instructions but it does not work. Not sure what I am doing wrong.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations