Run macro w/ relative reference for File name (changes monthly)

arndtmiles

New Member
Joined
Aug 18, 2015
Messages
6
Each month I update/change the file name and have had do manually go in and edit all macros. Is there a way to avoid this? Also, from what I've seen online, many recommend using "ActiveWookbook" or something similar....this will not work for me as I have macros pulling from multiple workbooks at a given time; meaning the active workbook changes as it jump in and out of reports collecting data for my one report.... Any help is much appreciated!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Without understanding the interaction between these workbooks, what is available, and what is chosen, it is quite hard to say.

If you were doing something that is like comparing this month to last month's, one way would be to write a macro that open's up this month's report and makes a copy named "ThisMonth", and opens up last month and makes a copy name "LastMonth". Then have your macro use these two copies to do what it needs (since those names will never change).

Likewise, you could have the macro prompt the users to select/enter the names of the files to work with, and then use VBA to dynamically capture and reference those file names in the VBA code.
 
Upvote 0

Forum statistics

Threads
1,215,019
Messages
6,122,707
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top