Drop Down w/Hyperlinks

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have no problem creating hyperlinks in Drop Downs. I have numerous links and I want to change “Text to display”, since the links can be quite long. I tried the standard right click then clicked on Hyperlink, but when I change it on my list and I have a validation list, the link no longer works. Any suggestions?

Thank you!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
One way - using minimal VBA

Create a list of short names and associated links
Dropdown list source is short names
Short Name is looked up to get link
VBA follows that link

In my example - everything is in one sheet & changing value in A2 takes user to the selected link link

Excel 2016 (Windows) 32 bit
A
B
C
D
E
1
Dropdown​
Lookup result​
ShortNameLink
2
abc file
C:\Test\abc.xlsm​
goooglehttp://www.google.com
3
wikihttps://en.wikipedia.org/wiki/Main_Page
4
abc fileC:\Test\abc.xlsm
5
Sheet: Sheet1


Dropdown in A2 with DataValidation list source column D
Formula in B2 =LOOKUP(A2,D:E,2,0)

VBA which is pasted into SHEET module
(right-click sheet tab \ select View Code \ paste code in code window \ {ALT}{F11} to go back to Excel)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Range("A2"), Target) Is Nothing Then
        On Error Resume Next
        ActiveWorkbook.FollowHyperlink Address:=Range("B2")
    End If
End Sub

Helper cell B2 is not required - could use this instead and allow VBA to do the LookUp
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Range("A2"), Target) Is Nothing Then
        Dim L As String
        On Error Resume Next
        L = WorksheetFunction.VLookup(Target, Range("D:E"), 2, 0)
        ActiveWorkbook.FollowHyperlink Address:=L
    End If
End Sub
 
Upvote 0
Have you tried the normal formula hyperlink function? You can use a formula in the hyperlink function in the text to display argument, so you dont need vba. And you can hade One single dropdown menu with some index match to fetch right Link and name
 
Upvote 0
As @Swayzy says, there are alternatives to using VBA
- it is easy to adapt example data in post#2 with a different formula in B2

Formula required in B2
=HYPERLINK(VLOOKUP(A2,D:E,2,0),A2 & " (or select in A2)")

VBA solution
- hyperlink is triggered by selecting from dropdown
Non-VBA
- user selects from dropdown in A2 and hyperlink is triggered when user clicks on link in B2
 
Upvote 0

Forum statistics

Threads
1,215,688
Messages
6,126,209
Members
449,299
Latest member
KatieTrev

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