Hello,
I have a tab where I have 20 hyperlinks to other tabs in the same document. I have 7 of those tabs hidden initially and I would like them to appear, select the sheet, and stay visible when their corresponding hyperlink is clicked. I was able to figure out how add code to make them appear when the link is clicked, however I know I need to add something else because now anytime I click on *any* of the 20 links, the result is that Sheet24 is selected, which I believe is because it is the last line of code so that is where the selection will always end up. I'm still a novice at this so I can't figure what I need to add/change to make it so that the selection goes to Sheet26 when the corresponding Sheet26 link is clicked, Sheet14 when the Sheet14 link is clicked, and so on. Not sure how to make the code "ignore" the other commands that come later in the code and are irrelevant to the link being clicked. I hope that makes sense but if there is anything I can do to clarify, let me know. Any assistance is greatly appreciated!
I have a tab where I have 20 hyperlinks to other tabs in the same document. I have 7 of those tabs hidden initially and I would like them to appear, select the sheet, and stay visible when their corresponding hyperlink is clicked. I was able to figure out how add code to make them appear when the link is clicked, however I know I need to add something else because now anytime I click on *any* of the 20 links, the result is that Sheet24 is selected, which I believe is because it is the last line of code so that is where the selection will always end up. I'm still a novice at this so I can't figure what I need to add/change to make it so that the selection goes to Sheet26 when the corresponding Sheet26 link is clicked, Sheet14 when the Sheet14 link is clicked, and so on. Not sure how to make the code "ignore" the other commands that come later in the code and are irrelevant to the link being clicked. I hope that makes sense but if there is anything I can do to clarify, let me know. Any assistance is greatly appreciated!
VBA Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
'Unhide Rollup Comparison when Hyperlink is clicked
Sheet26.Visible = xlSheetVisible
Sheet26.Select
'Unhide Pg1 Comparison when Hyperlink is clicked
Sheet14.Visible = xlSheetVisible
Sheet14.Select
'Unhide Pg2 Comparison when Hyperlink is clicked
Sheet16.Visible = xlSheetVisible
Sheet16.Select
'Unhide Pg3 Comparison when Hyperlink is clicked
Sheet18.Visible = xlSheetVisible
Sheet18.Select
'Unhide Pg4 Comparison when Hyperlink is clicked
Sheet20.Visible = xlSheetVisible
Sheet20.Select
'Unhide Pg5 Comparison when Hyperlink is clicked
Sheet22.Visible = xlSheetVisible
Sheet22.Select
'Unhide Pg6 Comparison when Hyperlink is clicked
Sheet24.Visible = xlSheetVisible
Sheet24.Select
End Sub