Hi I wonder if anybody can help on this, I have a register which in column A holds a unique certificate number. I then have to RH click and create a hyperlink to the PDF cert with the same number in a folder "L:\MATERIALS\Material Certification\03-PLATE"
I am trying to get some code to work so I can select a bunch of these cells in column A and create hyperlinks to each selected cell automatically.
I have something wrong because it is skipping the line of code below
Full code below
Any help is much appreciated
I am trying to get some code to work so I can select a bunch of these cells in column A and create hyperlinks to each selected cell automatically.
I have something wrong because it is skipping the line of code below
VBA Code:
ActiveSheet.Hyperlinks.Add Anchor:=c, Address:=p & s, TextToDisplay:=c.Value
Any help is much appreciated
Code:
Sub InsertHyperlinks()
Const p = "L:\MATERIALS\Material Certification\03-PLATE"
Dim c As Range
Dim s As String
Selection.Hyperlinks.Delete
For Each c In Selection
s = Dir(p & c.Value & ".pdf")
If s <> "" Then
ActiveSheet.Hyperlinks.Add Anchor:=c, Address:=p & s, TextToDisplay:=c.Value
End If
Next c
End Sub