I am a novice VBA user. I have a menu page with different cells that all hyperlink to hidden sheets. All sheets unhide except a few that give me the "Run Time error 9 - Subscript out of range". Where is my error? Thank you for looking! Below is a pic of the debug (Error is in RED) line and the code:
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
If ws.Name = "Instructions" Then
ws.Visible = True
ElseIf ws.Name = "IRA Matrix" Then
ws.Visible = True
ElseIf ws.Name = "Activity List" Then
ws.Visible = True
Else
ws.Visible = (ws.Name = Me.Name)
End If
Next
End Sub
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
If ws.Name = "Instructions" Then
ws.Visible = True
ElseIf ws.Name = "IRA Matrix" Then
ws.Visible = True
ElseIf ws.Name = "Activity List" Then
ws.Visible = True
Else
ws.Visible = (ws.Name = Me.Name)
End If
Next
End Sub