Automating Hyperlinks

Clo

New Member
Joined
Oct 26, 2006
Messages
1
Hi,
I am new to this posting thing, but I read over some of your postings and found very helpful hints. This place is really cool.

Here is my problem. I have a excel spreadsheet that contains a column with numeric and text references. In a separate directory I have the same reference as pdf files. I would like to hyperlink this pdf files to the corresponding reference in my Excel sheet.

Right now I manually select each individual reference and hyperlink it to the pdf file. This is time consuming for over 300 entries. Any suggestions on how to do this quicker?

Any help would be greatly appreciated,

Best regards,
Clo
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Why not use the HYPERLINK worksheet function?
 
Upvote 0
Clo
Try this out
Code:
Sub test()
Dim RN As Range, j As Integer
Dim Filename As String, FilePathName As String

Set RN = Selection

For j = 2 To RN.End(xlDown).Row
    Filename = RN(j)
    FilePathName = RN(1) & RN(j)
    With Worksheets(RN.Parent.CodeName)
        .Hyperlinks.Add Anchor:=.Range(RN(j).AddressLocal), _
            Address:=FilePathName, _
            TextToDisplay:=Filename
    End With
Next
End Sub
select range with first cell have the file path and then the filenames there after
e.g
c:\pdf folder\
book1.pdf
book2.pdf
etc....
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,900
Members
449,194
Latest member
JayEggleton

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