Macro linking to wrong workbook

T

Tim879

I have a monthly process where each month I get a new report. In order
to calculate the numbers I need, I open the prior month file and copy
the tabs lookups / pivots I need.

I have macros stored within those tabs to update the pivots and run
selected filters.

In order to run the pivots, I created command buttons on the pivot tab
assigned to run each macro.

The issue I am having is once I move the tabs into the new workbook,
the command buttons try to run the macros from the prior month file
and not the current month file.

I know how to correct this by reassigning the buttons but it's
annoying to have to do this every month.

Any suggestions on how to have the buttons simply refer to the macros
in the current workbook? One other complication, other people use this
file as well so I cannot store the macros in my personal macro
workbook since they won't be able to access them.

(If it matters at all, the macros are actually stored within the sheet
as opposed to a module in the workbook).
 
K

Kevin B

You can put the macros you need in a personal macro workbook, which will
open in the background each time you start Excel, making those macros
available to any workbook.

Or you can create a template file and move the data into your template each
month.
 
T

Tim879

The latter solution may work but it would require a good deal of work
on my end as the monthly file I receive is already linked to other
files so I'm not quite sure creating a template would be worth it.

also the personal macro work book would work for me but not other
people who need to access the macros.

I'm just surprised that I can't find a way to tell the button to run
the selected macro from the current workbook.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top