use a macro on a closed workbook

tla280

New Member
Joined
Jul 8, 2011
Messages
4
Hey all,

I've written a macro that works fine if I call it from the active sheet (that's how I wrote it). But I now need to use the same macro across multiple sheets in multiple work books. Or I guess I could copy all the ranges my macro needs from the various workbooks to this new one. Then run my macro. Either way I need some help.

My macro in a nutshell, takes a range and sorts it, then after culling out specific rows passes them to a function to summarize them. That gets passed back as an array then output to a range. There are two lines where I explicitly use sheet references. When I sort and when I output. Both use the active sheet property. Im actually on lunch and posting on my phone. If you need to see my code I can supply it shortly.

Any advice appreciated.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I'm afraid I've run into a problem there. I can't. Login to forums it seems on work computers and can't copy all the code on my phone via email so I'm stuck until I get home in about 2 hours.

But so far I can call the function from another workbook. And get it to do everything correctly. Just trying to get it to return something. Because that sub was not written to return a value or variable
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

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