script to increase last number in cell entry for hyperlink

  • Thread starter Thread starter kim
  • Start date Start date
K

kim

Hi
I have an excel sheet with 4,000 rows each having a record of a picture. I
need to hyperlink a cell entry in each row to open the picture when it is
clicked.
I can do this through insert hyperlink command but don't want to do it 4,000
times!

Is there a way to do this with vba? Either from a macro button or running a
script that would increment the file name by 1 digit for each row i.e.
Filepathpicture1 (set by hyperlink)
filepathpicture2
filepathpicture3 and so on with the script changing the picture number.
Thanks
 
VBA is really not needed here:

In A1 enter:

C:\Documents and Settings\Owner\My Documents\My Pictures\100_006

In B1 enter:

=ROW()&".jpg"

In C1 enter:

=HYPERLINK(A1 & B1)

This will hyperlink to 100_0061.jpg

Just copy A1 thru C1 down the column to increase the numerical sequence.
 
Back
Top