Excel Vba Hyperlink help

wahmed

Board Regular
Joined
Jun 28, 2010
Messages
66
Hi,

Can anyone help me to understand this Excel vba follow hyperlink method ?


Range("A1").Hyperlinks(1).Follow

My Question is why we need to Write .hyperlinks(1).follow what does (1) stand for in this method, can we not just use .hyperlinkes.follow ?

Waiting for your help in detail to understand it easily.

regards

Wahmed
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Dear Davernut,

Thanks for your reply to my question.

Sorry but still it is not cleared :( if we have 100 hyperlinks in a worksheet then we use Hyperlinks(1).follow for all of them, so what does index stand for ? can we use Hyperlinks(2) or (3) as well ??

Please explain.

Regards

Wahmed
 
Upvote 0
If you are selecting only one cell or a range with 1 cell on your worksheet then you would use:

Code:
   ActiveSheet.Range("G10").Select
   Selection.Hyperlinks(1).Follow

If you are selecting a range that contains several hyperlinks in it
you would have to specify which link you wanted to follow.
Code:
   ActiveSheet.Range("G10:G15").Select
   Selection.Hyperlinks(x).Follow
 
where x = one of a number of hyperlinks in that range.
 
Upvote 0
THAT'S what the number is for? You learn something new every day...

so if i do this...
PHP:
ActiveSheet.Range("G1:G5").Select
Selection.Hyperlinks(5).Follow

does it activate ALL of the links, or just number 5 (g5)?
 
Upvote 0
Yes I just learned the very same 20 minutes ago : )

It would follow the link in G5 assuming each cell has a hyperlink.

If there are less than 5 links in that range then - 'Subscript out of range'.
 
Upvote 0
Dear Davernut,

thanks for explaining.

but excel is assuming .hyperlinks(5).follow with 5th sheet of a workbook whether name of sheet has changed....

Please recheck and then reconfirm.

regards

Wahmed
 
Upvote 0
Please post the code you are using and an explanation of what you are seeing so I can understand.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,833
Members
452,947
Latest member
Gerry_F

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