Hyperlinks to hidden sheets and re-hiding the hyperlinked sheet when done.

onejay

New Member
Joined
Mar 29, 2023
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
I'm using the below code to hyperlink to hidden sheets, then re-hiding the sheet when done. Within the hyperlink sheet, I have six hyperlinks, but only four function as intended despite using the same VBA code. of the two that don't work, one refuses to open, but will auto hide if it is manually unhidden. The other one opens but not before returning a "Run-time error '13': Type mismatch", but will not auto hide when done. Any help would be greatly appreciated, because this is driving me a bit insane trying to figure out where I went wrong. If it helps the four hyperlinks that work are labeled GCS_70; GCS_71; GCS_72; and GCS_73. The one that will not open, but will auto hide if manually unhidden is labeled GSC_Audit. and the hyperlink that will work, but won't auto hide is SCC_Audit. Thanks again.

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
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
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I always remove On Error statements to see where the code is failing.
 
Upvote 0

Forum statistics

Threads
1,214,575
Messages
6,120,344
Members
448,956
Latest member
Adamsxl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top