做了個Demo給樓主,Demo中隱藏了Sheet3當超連結連結到Sheet3時,顯示Sheet3並實現超連結跳轉。當離開Sheet3時,Sheet3自動隱藏:插入模組並定義一個全域性變數:Public shtVisible As Variant在WorkBook中插入程式碼:Private Sub Workbook_Open()ThisWorkbook.Sheets(3).Visible = FalseDim i!ReDim shtVisible(Sheets.Count)For i = 1 To Sheets.Count shtVisible(i) = Sheets(i).VisibleNextEnd SubPrivate Sub Workbook_SheetDeactivate(ByVal Sh As Object)Dim i For i = 1 To Sheets.Count If Sheets(i).Name = Sh.Name Then Sh.Visible = shtVisible(i) NextEnd SubPrivate Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)If InStr(Target.SubAddress, "!") > 0 Then Dim sht As Object Set sht = Sheets(Left(Target.SubAddress, InStr(Target.SubAddress, "!") - 1)) Application.EnableEvents = False sht.Visible = True Target.Follow Application.EnableEvents = TrueEnd IfEnd Sub附件請下載參考
做了個Demo給樓主,Demo中隱藏了Sheet3當超連結連結到Sheet3時,顯示Sheet3並實現超連結跳轉。當離開Sheet3時,Sheet3自動隱藏:插入模組並定義一個全域性變數:Public shtVisible As Variant在WorkBook中插入程式碼:Private Sub Workbook_Open()ThisWorkbook.Sheets(3).Visible = FalseDim i!ReDim shtVisible(Sheets.Count)For i = 1 To Sheets.Count shtVisible(i) = Sheets(i).VisibleNextEnd SubPrivate Sub Workbook_SheetDeactivate(ByVal Sh As Object)Dim i For i = 1 To Sheets.Count If Sheets(i).Name = Sh.Name Then Sh.Visible = shtVisible(i) NextEnd SubPrivate Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)If InStr(Target.SubAddress, "!") > 0 Then Dim sht As Object Set sht = Sheets(Left(Target.SubAddress, InStr(Target.SubAddress, "!") - 1)) Application.EnableEvents = False sht.Visible = True Target.Follow Application.EnableEvents = TrueEnd IfEnd Sub附件請下載參考