Variable Hyperlink in VB

russelldt

Board Regular
Joined
Feb 27, 2021
Messages
160
Office Version
  1. 365
Platform
  1. MacOS
Hello

I hope some genius out there can help me.

I have a cell in sheet 1(call it the source cell), hyperlinked to a hidden sheet. The text in the source cell and Sheet Name are the same, so when i select the cell, the hidden sheet opens. Here is the VB routine i am using:


Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

Dim shtName As String
shtName = Target.Name

Sheets(shtName).Visible = xlSheetVisible
Sheets(shtName).Select
End Sub


I now have a dropdown menu in the source cell and I have to select different text depending on which sheet i want to access by the hyperlink. There is always a unique sheet for the different text options. I just can't get this to work.

Looking for help. please

Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Here is a screenshot of the sheet.
 

Attachments

  • Screen Shot 2021-09-03 at 14.22.57.png
    Screen Shot 2021-09-03 at 14.22.57.png
    156 KB · Views: 9
Upvote 0
That doesn't tell me where the other DV cells are. ;)
 
Upvote 0
All of the excel sheets, bear the name that is shown in the cell. At present these are accessed by the hyperlink (blue underlined script). EG, clicking on "Labour" opens hidden sheet called "Labour".

Hope that this helps,

Thanks
 

Attachments

  • Screen Shot 2021-09-03 at 14.32.19.png
    Screen Shot 2021-09-03 at 14.32.19.png
    217.1 KB · Views: 9
Upvote 0
Are you talking about further data validation cells, or hyperlinks?
 
Upvote 0
Ok, i have figured out how to continue with the hyperlinks and the dropdown. Thanks for the support.

One final question, i used cell A3 in the above example as a reference. The actual cell with the dropdown is C29.

Do I make the change here :If Target.Address(0, 0) = "A3" Then

thanks
 
Upvote 0
Ok, i have figured out how to continue with the hyperlinks and the dropdown. Thanks for the support.

One final question, i used cell A3 in the above example as a reference. The actual cell with the dropdown is C29.

Do I make the change here :If Target.Address(0, 0) = "A3" Then

thanks
Thanks - and as a Springbok supporter, I have great respect for your Rugby team, and of course your knowledge and support
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0
Glad to help & thanks for the feedback.
If you want to do that, how about
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.CountLarge > 1 Then Exit Sub
   If Target.Address(0, 0) = "A3" Then
      If Evaluate("isref('" & Target.Value & "'!A1)") Then
         With Sheets(Target.Value)
            .Visible = xlSheetVisible
            Application.Goto .Range("A1"), True
         End With
      Else
         MsgBox "Sheet " & Target.Value & " does not exist"
      End If
   End If
End Sub
Hello, If i want to have more than I dropdown, say in cells C15, and C16, C17 - would I use this script 3 times, just changing "A1" to the relevant cell.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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