Hi Guys
my code goes through a range and checks to see if there are 2 files relating to the entry and adds a hyperlink.
It all works fine, cept one little thing.
It adds a hyperlink to the cell before the range ("A3") and gives it links that the last cell gets.
Any ideas why its hyperlinking a cell that isnt even in the range?
Thanks, Keegan
my code goes through a range and checks to see if there are 2 files relating to the entry and adds a hyperlink.
It all works fine, cept one little thing.
It adds a hyperlink to the cell before the range ("A3") and gives it links that the last cell gets.
Any ideas why its hyperlinking a cell that isnt even in the range?
Thanks, Keegan
Code:
For Each CL In Workbooks(INV).Sheets("Specs").Range("A4:A" & Workbooks(INV).Sheets("Specs").Range("A65536").End(xlUp).Row)
File = CL
Desc = CL.Offset(0, 1)
folder = CL.Offset(0, 2)
If folder = "Packaging" Then
folder = CL.Offset(0, 3)
End If
folder = folder & "\"
MyFile = Dir(MyPath & Spec & folder & File & ".pdf")
If MyFile = File & ".pdf" Then
CL.Hyperlinks.Add _
Anchor:=Selection, _
Address:=MyPath & Spec & folder & File & ".pdf", _
TextToDisplay:=File
Else
CL.Hyperlinks.Delete
CL = File
End If
MyFile = Dir(MyPath & Art & folder & File & ".pdf")
If MyFile = File & ".pdf" Then
CL.Offset(0, 1).Hyperlinks.Add _
Anchor:=Selection, _
Address:=MyPath & Art & folder & File & ".pdf", _
TextToDisplay:=Desc
Else
CL.Offset(0, 1).Hyperlinks.Delete
CL.Offset(0, 1) = Desc
End If
Next CL