VBA to open hyperlink in a hidden sheet which also containing hyperlink

ErynK

New Member
Joined
Mar 9, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Hi, i have a workbook containing plenty sheets.
I would like to set the sheet2 @ Overview as my dashboard. Which, when i click link in Overview, it will unhide sheet linked and naviagate to it. Then, hide that opened sheet when i go go back to Overview.

I found a macros fulfilling the above needs perfectly.

However, i would like to get help to get a code that can achieve the below approach:
1. Let assumes the Overview dashboard sheet is A.
2. When i click link in A, it will unhide & redirect me to the corresponded hidden sheet(Assumes its B).
3. When i click on hyperlink in B, it will also unhide and redirects me to the hidden sheet C.
4. When i go back to A, the rest of the sheets will hide again.

1678338207376.png


Perhaps there were someone here can help or guide me through to achieve the above solutions.
Ps: I was completely new to the macros coding. Hence it is appreciated if you are willing to share the code to me directly or can teach me how to code it. I'm eager to learn :)

Thanks in advanced!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
This is the code as attached in the picture:


VBA Code:
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
            If Sh.CodeName <> "Sheet2" Then
               Sh.Visible = xlSheetVeryHidden
            End If
        End Sub

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)
            Sheetname = VBA.Replace(Left(Target.SubAddress, InStr(1, Target.SubAddress, "!") - 1), "'", "")
            Sheets(Sheetname).Visible = True
            'Sheets(Sheetname).Activate
            Application.EnableEvents = False
            Target.Follow
            Application.EnableEvents = True
End Sub
 
Upvote 0
Hi, i have a workbook containing plenty sheets.
I would like to set the sheet2 @ Overview as my dashboard. Which, when i click link in Overview, it will unhide sheet linked and naviagate to it. Then, hide that opened sheet when i go go back to Overview.

I found a macros fulfilling the above needs perfectly.

However, i would like to get help to get a code that can achieve the below approach:
1. Let assumes the Overview dashboard sheet is A.
2. When i click link in A, it will unhide & redirect me to the corresponded hidden sheet(Assumes its B).
3. When i click on hyperlink in B, it will also unhide and redirects me to the hidden sheet C.
4. When i go back to A, the rest of the sheets will hide again.

View attachment 87109

Perhaps there were someone here can help or guide me through to achieve the above solutions.
Ps: I was completely new to the macros coding. Hence it is appreciated if you are willing to share the code to me directly or can teach me how to code it. I'm eager to learn :)

Thanks in advanced!
Hmm i think the above request is actually achieved. I tried clicking on hyperlink in C and that links actually worked to navigate me to the corresponding hidden sheet without issue.

Now let me correct my issue:
I'm actually also set shape containing hyperlink. From what i read and study, the code i was now using is not applicable for shape a.k.a button.

If i wishes to use VBA to unhide and redirect to that particular hidden sheet via shape, i saw some people suggest to right click on the shape and assign new macro that are redirecting me to the specific locations.

Which, it means location that the hyperlink address i use previously no longer worked. Intead, i has to repeat this assign macro step for every single of this shape.

Long story short, is there any where round to skip that procedure while kept that shape button worked? I have a lots shape applied so it will be a lots job to replacing a new macro to each of them :(
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top