Hi, hope you can help
I have a workbook with hundreds of spreads. However I have used a macro to hide them all and unhide them by using a hyperlink for all of the spread sheets. I.e. Index sheet with all the names of different sheets and by clicking on a specific sheets name it opens and by clicking back on Index sheet it hides. It works perfectly fine, however I would like to add another hyperlink in the index sheet, this time that would get me to a website. The hyperlink works and it redirects me to the webpage, but it comes up with a Runtime error '9' every time I try to open the hyperlinked web page
The code I use is below. Even thou it works, I would like not to get an error message once opening a hyperlink for a webpage, as this spread would be widely used once completed.
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
I hope to find a solution for the problem, please advise..
I have a workbook with hundreds of spreads. However I have used a macro to hide them all and unhide them by using a hyperlink for all of the spread sheets. I.e. Index sheet with all the names of different sheets and by clicking on a specific sheets name it opens and by clicking back on Index sheet it hides. It works perfectly fine, however I would like to add another hyperlink in the index sheet, this time that would get me to a website. The hyperlink works and it redirects me to the webpage, but it comes up with a Runtime error '9' every time I try to open the hyperlinked web page
The code I use is below. Even thou it works, I would like not to get an error message once opening a hyperlink for a webpage, as this spread would be widely used once completed.
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
I hope to find a solution for the problem, please advise..