Hello all, I am working with a file that i have multiple sheets. I have code that is written to automatically hid the sheets except the Index. I have hyperlinks that go to the various sheets but I am also trying to have hyperlinks to go to a website. When clicking on the hyperlinks for the website, I get a error as follows:
Run-time error '9':
Subscript out of range.
Here is the code I am using to hid and activate the sheets when the hyperlink is selected. PLEASE HELP!
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim strSheet As String
If InStr(Target.Parent, "!") > 0 Then
strSheet = Left(Target.Parent, InStr(1, Target.Parent, "!") - 1)
Else
strSheet = Target.Parent
End If
Sheets(strSheet).Visible = True
Sheets(strSheet).Select
End Sub
Private Sub Worksheet_Activate()
Dim ws As Excel.Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = (ws.Name = Me.Name)
Next
End Sub
Bookmarks