shahin
Active Member
Hi there everybody! Good day.I have some titles of pictures listed in a spreadsheet. I would like to add hyperlinks to that titles so that when i click these titles i can get the pictures which I downloaded and stored in D drive. I recorded a macro to apply it myself but the
code i got is applicable for selection range only. Now I like to make it dynamic
so that it add to the hyperlinks in a collection of range. A little push
from somebody experienced with this may help me accomplish my code. Thanks in advance. FYC, I'm pasting here the code I would like to work with.
This is what i recorded:
I tried like the below code:
code i got is applicable for selection range only. Now I like to make it dynamic
so that it add to the hyperlinks in a collection of range. A little push
from somebody experienced with this may help me accomplish my code. Thanks in advance. FYC, I'm pasting here the code I would like to work with.
This is what i recorded:
Code:
Sub CreateHyperlink()
Range("B4").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"D:\Test\Images\man-on-fire-1987-1080p-poster.jpg", TextToDisplay:= _
"man-on-fire-1987-1080p-poster.jpg"
End Sub
I tried like the below code:
Code:
Sub CreateHyperlink()
dim cel as variant
'''To be spsecific what should i declare cel as [Range, object or variant]'''
for each cel in range("B2:B" & cells(rows.count,1).end(xlup).row)
ActiveSheet.Hyperlinks.Add Anchor:=cel, Address:= _
"D:\Test\Images\" & cel, TextToDisplay:= cel
next cel
End Sub