Change cells containing links to files to Hyperlinksl

D

Don

In Excel, I have many cells thatcontain a link to a file
elsewhere. I need to convert all of them to hyperlinks
automatically. I cannot go to each one and put the same
link data into the Hyperlink destination window, too many.

exp: cell contains this:

#C:\ProgramFiles\WebScraper\Photos\6128_N_0043_Aerial.jpg#

I need to make this a link that I can just click on the
cell and it takes me to that .jpg

thank you,

Don
 
J

Juan Sanchez

Don

Try this code...
=====================================
Sub Convert2Hyperlink()

Dim MyCell As Range
Dim HLink As String
Set MyCell = Selection

For Each MyCell In MyCell
HLink = Mid(MyCell, 2, Len(MyCell) - 2)
ActiveSheet.Hyperlinks.Add anchor:=MyCell, Address:=HLink
Next MyCell

End Sub
==============================

Cheers
Juan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top