LauraSophie
New Member
- Joined
- Nov 14, 2017
- Messages
- 7
Hi,
I have a macro that opens a specific file, opens it, takes some data and then closes it again. The premise is there are so many files that need opening that it will do them one by one and then close them afterwards. The rest of the macro works completely fine but I want to be able to have the filename changeable without editing the macro.
Part of the macro is:
Workbooks.Open Filename:= _
"H:\FOLDER\SUBFOLDER\Filename.xlsx" _
, UpdateLinks:=3
Windows("Book1").Activate
Columns("D:D").Select
Selection.Copy
Do you know of a way to have the filename referenced in a cell within the worksheet as opposed to being called out specifically in the macro? I have a CELL function included in the worksheet that gives the exact filename but is there any way of getting the macro to look for this instead of having to specify it? That way if the end user updates the filename (probably with edit links) in the cell on the worksheet they don't need to go in an amend the macro?
Thanks!
I have a macro that opens a specific file, opens it, takes some data and then closes it again. The premise is there are so many files that need opening that it will do them one by one and then close them afterwards. The rest of the macro works completely fine but I want to be able to have the filename changeable without editing the macro.
Part of the macro is:
Workbooks.Open Filename:= _
"H:\FOLDER\SUBFOLDER\Filename.xlsx" _
, UpdateLinks:=3
Windows("Book1").Activate
Columns("D:D").Select
Selection.Copy
Do you know of a way to have the filename referenced in a cell within the worksheet as opposed to being called out specifically in the macro? I have a CELL function included in the worksheet that gives the exact filename but is there any way of getting the macro to look for this instead of having to specify it? That way if the end user updates the filename (probably with edit links) in the cell on the worksheet they don't need to go in an amend the macro?
Thanks!