pauldonnelly16
New Member
- Joined
- Aug 3, 2018
- Messages
- 2
Hi,
Hoping that someone can help with a hyperlink / VBA problem that's driving me crazy!?
Basically, I have a workbook with a front sheet which contains a column of hyperlinks to other sheets within the same workbook. Each of these hyperlinks is built using the =HYPERLINK formula rather than a right-click>Link type hyperlink. I had to build the hyperlinks using the formula method as various preceding columns are concatenated in order to build the name of the sheet which requires linking to.
So, with all sheets in the workbook unhidden, the formulated hyperlinks work perfectly. I can use them to jump to the relevant sheets with no problems. However, to tidy up the workbook, I want to be able to hide all of the individual sheets except for the front sheet - and then when I click on a hyperlink, only the relevant sheet would be unhidden for editing & then re-hidden once a 'Back' button is pressed. I just can't get the hyperlinks to work once the individual sheets are hidden - clicking the links does nothing, and I can't figure out why or how to fix it?
I've done something similar in the past using the sheet code below - but this one only seems to work using 'normal' hyperlinks. I'm guessing it's not working for me now because i'm using the =HYPERLINK formula? If so, anyone any ideas how I can get around this and achieve what I'm trying to do? Apologies if this has been answered before, I had a search but couldn't find anything.
Cheers,
Paul
Hoping that someone can help with a hyperlink / VBA problem that's driving me crazy!?
Basically, I have a workbook with a front sheet which contains a column of hyperlinks to other sheets within the same workbook. Each of these hyperlinks is built using the =HYPERLINK formula rather than a right-click>Link type hyperlink. I had to build the hyperlinks using the formula method as various preceding columns are concatenated in order to build the name of the sheet which requires linking to.
So, with all sheets in the workbook unhidden, the formulated hyperlinks work perfectly. I can use them to jump to the relevant sheets with no problems. However, to tidy up the workbook, I want to be able to hide all of the individual sheets except for the front sheet - and then when I click on a hyperlink, only the relevant sheet would be unhidden for editing & then re-hidden once a 'Back' button is pressed. I just can't get the hyperlinks to work once the individual sheets are hidden - clicking the links does nothing, and I can't figure out why or how to fix it?
I've done something similar in the past using the sheet code below - but this one only seems to work using 'normal' hyperlinks. I'm guessing it's not working for me now because i'm using the =HYPERLINK formula? If so, anyone any ideas how I can get around this and achieve what I'm trying to do? Apologies if this has been answered before, I had a search but couldn't find anything.
Cheers,
Paul
Code:
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim strSheet As String
strSheet = Left(Target.SubAddress, InStr(1, Target.SubAddress, "!") - 1)
If Left(strSheet, 1) = "'" Then
strSheet = Mid(strSheet, 2, Len(strSheet) - 2)
End If
Worksheets(strSheet).Visible = xlSheetVisible
Application.EnableEvents = False
Target.Follow
Application.EnableEvents = True
End Sub</code>