This is the macro that I have
Sub Create_Hyperlinks()
Dim fs, fol, fil, count
count = 1
Set fs = CreateObject("Scripting.filesystemobject")
Set fol = fs.getfolder("\\ABCDEFG.com\workgroupABC\TDBU26\E&TS DR\Working\Quality\Inspections\M&I_Inspections\Photos_ODI\05 May\David Butler\") 'Change This Every Month
For Each fil In fol.Files
Range (Cells(Rows.count, "U").End(xlUp).Offset(1, 0).Address)
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=fil.Path, TextToDisplay:=fil.Name
count = count + 1
Next
End Sub
Because every month the URL address will be different, I don't want to have to go every month and change:
1) The month section of the URL: 05 May\
2) The name of the inspector Frank Butler\
Rather than put in the macro the full URL path, how can I have it say instead
Set fol = fs.getfolder("\\ABCDEFG.com\workgroupABC\TDBU26\E&TS DR\Working\Quality\Inspections\M&I_Inspections\Photos_ODI\05 May\David Butler\")
to
Set fol = fs.getfolder("A34")
Where A34 in the cell of Sheet1 (or whichever sheet) gives the updated URL.
Bookmarks