Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I copy the path of a hyperlink into a cell 1

Status
Not open for further replies.

BrotherArnold

Technical User
Jul 12, 2002
16
GB
Hi,

I'm sure this is peasy but it's got me scratching my head so much it's hurting!

All I need to do is copy the hyperlink to another cell using VBA.

I'm currently stuck on:

Cells(2,1) = Cells(1,1)

... which only copies the text you see in the link when what I actually want is the path behind the link to appear in the cell.

Any ideas?

Thanks in advance

Rich

 
Something like

ActiveSheet.Hyperlinks.Add Anchor:=Cells(2, 1), Address:=Cells(1, 1).Hyperlinks(1).Address

should work.

A.C
 
Cheers acron,

That put me on the right track. I realise now I was a bit vague in my request. What I wanted was just the address without the link set up so your code helped me to come up with...

Cells(2,1) = Cells(1,1).hyperlinks(1).address

So thanks for your help.

Rich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top