Hyperlink Question

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,060
Say I have a value in a cell which is the hyperlink address, what VBA script would I need to run the hyperlink, based on whatever value is in the activecell at the time, either to a cell location or web address.

I.e I run a macro and it creates and follows the hyperlink.

cell value = Sheet1!A1 (it would go to that cell)

cell value = www.mrexcel.com (it would go to that web site)

Thanks.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Something like this would follow the 1st hyperlink of a selected range

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Hyperlinks.Count <> 0 Then
        Target.Hyperlinks(1).Follow
    End If
End Sub
 
Upvote 0
Thanks for your reply Tweedle,

The script is not really what I am after as there are no hyperlinks in the cells just values/ references which I need turned into hyperlinks and then followed.

I have found some scripts to make hyperlinks, so I will check those out and then use a follow hyperlink script.

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,161
Messages
6,123,375
Members
449,098
Latest member
Jabe

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