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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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,906
Messages
6,127,660
Members
449,395
Latest member
Perdi

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