I have a main excel page (we will call it dashboard)
It has cells that link to hidden sheets in my VB and it also has cells that link to websites. All the internal stuff works fine finding other sheets. It is also successful going out to the websites by clicking but it always throws up Run-Time error ‘9’: Subscript out of range when I click on one of the cells that references an external website. Internal pages are fine. Furthermore, if I go into one of the other sheets and reference a website through a link…no error and works fine. It’s just from that main dashboard page that it doesn’t like external linking.
**Code on Dashboard page: **
Option Explicit
Dim bFlag As Boolean
'--------->>
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim SH As Worksheet
Dim arr As Variant
If bFlag = True Then Exit Sub
arr = Split(Target.SubAddress, "!")
Set SH = ThisWorkbook.Sheets(arr(0))
SH.Visible = xlSheetVisible
bFlag = True
Target.Follow
bFlag = False
End Sub
'<<=========
**Code on all other hidden sheets: **
'=========>>
Option Explicit
Private Sub Worksheet_Activate()
End Sub
'--------->>
Private Sub Worksheet_Deactivate()
Me.Visible = xlSheetHidden
End Sub
'<<=========
Tried many different things and I know it’s just something I’m not adding correctly to the dashboard code.