I'm trying to create an index of files in a directory. I've managed to copy filenames into Excel, but I'd like them to be hyperlinks to the files. Can this be done?
You're not giving us much to go on here, but if you have a list of filenames in column A, then select column B and type=HYPERLINK(A1) and enter it with <Ctrl><Enter>.
To save you copying the filenames in here's a macro
Sub ListFiles()
'Before you run these macros, open a new worksheet and select the cell of the range _
into which you want the file names to be placed. To list different file types, you must _
modify the sample macros by changing the argument in the Dir() function. _
To return all Microsoft Excel add-in macros, replace "*.XLS" with "*.XLA," and so on. _
The specified directory can be any valid directory. To search a different folder, change directory to the folder containing your Excel workbook files or you could add an inputbox to make it more interactive.
F = Dir("g:\*.xl*" '
Do While Len(F) > 0
ActiveCell.formula = F
ActiveCell.Offset(1, 0).Select 'By Columns
'ActiveCell.Offset(0, 1).Select 'By Rows
F = Dir()
Loop
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.