Change cells containing links to files to Hyperlinksl

  • Thread starter Thread starter Don
  • Start date Start date
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
 
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
 
Back
Top