I have a column that has a list of paths and file names. I need these to be
turned into hyperlinks to the file listed. I cannot however use the
=Hyperlink formula, because when I do that the link does not come through
when i covert the spread sheet to a PDF, it only seems to work when I insert
the hyperlink. Please tell me there is a way to do this.
Paste this macro into a VBA module in your workbook. Select the cells to be
converted to hyperlinks - it's okay if the selected range includes blank
cells. Then run the AddHyperlinks macro (Tools >> Macro >> Macros >>
AddHyperlinks >> Run).
Public Sub AddHyperlinks()
Dim Rng As Range
For Each Rng In Selection
If Len(Rng.Value) > 0 Then
ActiveSheet.Hyperlinks.Add Anchor:=Rng, _
Address:=Rng.Value, TextToDisplay:=Rng.Value
End If
Next Rng
End Sub
If you are new to macros, david mcritchie has some instructions on his site
for navigating the vba editor and how to copy/paste macros into your project.
http://www.mvps.org/dmcritchie/excel/excel.htm
Hope this helps,
Hutch
> I have a column that has a list of paths and file names. I need these to be
> turned into hyperlinks to the file listed. I cannot however use the
> =Hyperlink formula, because when I do that the link does not come through
> when i covert the spread sheet to a PDF, it only seems to work when I insert
> the hyperlink. Please tell me there is a way to do this.