Hyperlink to Hidden Sheet

IDAK

New Member
Joined
Mar 5, 2020
Messages
17
Office Version
  1. 2016
Platform
  1. Windows
Hello all,

Can someone help me out? I am still a noob to the VBA coding but I am having issues with getting my Hyperlinks to work to a hidden sheet.

My main sheet "Project Checklist" has four hyperlinks on it directing it to a Hidden sheets one of those sheets is the " Alarm Check Process" sheet. When the sheet is hidden the hyperlinks no longer work.

My "Alarm Check Process" sheet does have a simple code on it to hide the page once you navigate away from it and it works. This code is as follows:

Private Sub Worksheet_Deactivate()
Me.Visible = xlSheetHidden
End Sub


I have tried using this code below on the "Project Checklist" sheet but I can not seem to get it to work.

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim ShtName As String
ShtName = Left(Target.SubAddress, InStr(1, Target.SubAddress, "!") - 1)
Sheets(ShtName).Visible = xlSheetVisible
Sheets(ShtName).Select
End Sub


Can someone help me and tell me what I might be doing wrong?

Thank you in advance.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi & welcome to MrExcel
How about
VBA Code:
ShtName = Replace(Left(Target.SubAddress, InStr(1, Target.SubAddress, "!") - 1), "'", "")
 
Upvote 0
I have tried replacing line 2 with what you provided and clicked save and closed visual basic and it still does not work.

When I click on Debug and run to cursor at the end of this entire code it does nothing.

I have this directly on the worksheet in visual basic.

Not really sure why I can not get this to work.
 

Attachments

  • 2020-03-05 08_44_30-Microsoft Visual Basic for Applications - T23 - Customer_Project Checklist...png
    2020-03-05 08_44_30-Microsoft Visual Basic for Applications - T23 - Customer_Project Checklist...png
    52.2 KB · Views: 30
Upvote 0
What error do you get & what line is highlighted?
 
Upvote 0
That is the issue no line is highlighted and no error is provided.

I my other code for the hidden sheet to deactivate gave me a highlighted line and an error when i had something wrong with it.
 
Upvote 0
In that case, in what way didn't it work?
 
Upvote 0
when I go to the sheet titled "Project checklist" and click on the hyperlink it does nothing now due to the "Alarm Check Process" sheet is hidden.
 
Upvote 0
Put a breakpoint on this line
Rich (BB code):
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim ShtName As String
ShtName = Replace(Left(Target.SubAddress, InStr(1, Target.SubAddress, "!") - 1), "'", "")
Sheets(ShtName).Visible = xlSheetVisible
Sheets(ShtName).Select
End Sub
and then click the hyperlink, what happens?
 
Upvote 0
Ok I have entered a break point on that line.

When I try and step through the code to get it to highlight each line to run next I can not get it to function.

My computer just chimes and that is it. No error, no highlighted lines or anything.
 
Upvote 0
You need to click the hyperlink, after setting the breakpoint.
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

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