Activating Hyperlinks via VBA

5th4x4

New Member
Joined
Mar 31, 2009
Messages
3
I have a column full of hyperlinks that I want to activate using vba (click-click-click right down the column, which opens IE tabs), but I cannot seem to find the method that will activate the hyperlink instead of just the cell.
I've tried some SendKey attempts, but still no luck.

Any ideas as to how this is done within vba ?<!-- google_ad_section_end -->
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Thanks for the welcome and the quick response !!!

That seems nice and simple.....
except....
this seemingly innocuous issue remains confounding :/

I tried Range("H2").Hyperlinks(1).Follow
...and it went and threw a Subscript out of Range error at me.
And after a few (lame) attempts to tweak things this way and that... still no love :/

Perhaps more detail might help shed some light as to why this might be happening.

Cell H2 contains the following: =HYPERLINK(I2)
Cell I2 contains a formula that concatenates a bunch of cells which produce a URL
(the URL is valid, as I am able to manually click on the hyperlinks in column H to launch IE to the desired URL)

So.....
do I maybe need to modify this code based on the particular manner in which I am using hyperlinks on this worksheet ?
 
Upvote 0
try
Shell "explorer.exe " & Range("h2").Text

the reason hyperlinks(1).follow not working thier is no conventional hyperlink in the cell so it will return out of range
 
Upvote 0
You are correct.... the hyperlink is not conventional, so it required calling IE and providing the link from within vba itself.
Nicely done. Thanks !!!

URL = Range("H2").Text
Shell "C:\Program Files\Internet Explorer\iexplore.exe " & URL, vbNormalNoFocus
 
Upvote 0
in a conventional hyper link with Range("A1").Hyperlinks(1).Follow the (1) is the item index number so for a range of one single cell "A1" containing a hyperlink will be 1
if the range covers more than one cell containing hyper links then their will be for than one item
 
Upvote 0
in a conventional hyper link with Range("A1").Hyperlinks(1).Follow the (1) is the item index number so for a range of one single cell "A1" containing a hyperlink will be 1
if the range covers more than one cell containing hyper links then their will be for than one item

Thanks! I think I get it...:)
 
Upvote 0
Hi, I have 2 questions. First, is it possible to use the script mentioned here:
Sub Hyperlink()
Shell "explorer.exe " & Range("J2").Text
End Sub

To activate a cell range? I.e could it open several links at once in the browser?

Secondly, is there a simply way to automate the F2/return key stroke to activate a cell so the Hyperlink becomes active. I've tried lots of different things but none of them seem to just automate the manual key stroke.

Thanks very much for any help you can give!

;)
 
Upvote 0
Two similar questions on this topic?
Using this code
URL = Range("H2").Text
Shell "C:\Program Files\Internet Explorer\iexplore.exe " & URL, vbNormalNoFocus



  1. Can it open multiple tabs rather than individual opens of Excel?
  2. Can you specify a range (like H2:h12 rather than just H2) so that it will “loop” through several rows in one column?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

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