• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to open filename held in a cell

DWM

New Member
I have a workbook with the file directories and names in cells C46, C48 C50 etc.


These are currently added as hyperlinks.


I would like to set up a macro/button to open all the files.


The file names will change over time.
 
DWM


How about this monster:

[pre]
Code:
Sub OpenMyFiles()
Dim c As Range
For Each c In Range("c48:c58")
If c.Text <> "" Then Workbooks.Open Filename:=c.Text
Next

End Sub
[/pre]

To use it:

Open your file

Goto VBA AltF11

Insert a new Code Module

Paste the code into the code module

Save the file as a Macro Enabled File *.xlsm

Link the macro to a Button or Shape etc
 
Looks good. I just need to change my cell data as it ios also used for lookups/sumifs with the ' on the front.


Hence the hyperlinks.


Thanks
 
Back
Top