assigning a macro

Woodyexcel

New Member
Joined
Jun 28, 2011
Messages
8
Help????
I am using one macro that is assigned to a button on the tool bar. I want to use it with mutiple files that have different names and the name changes. How would I make this work? thanks in advance.


Woody
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
What is code behind the button?

You could use ActiveWorkbook, ActiveSheet, Selection, ... to "generalize" a macro, rather than operating on the same hardcoded sheets and workbooks.
 
Upvote 0
ThisWorkbook.Multisort
It automatically assigns the name of the workbook I am working in. Is the problem that the macro is in the workbook? How do I make that a general macro?

Woody
 
Upvote 0
Just like I said, use ActiveWorkbook, for instance.
 
Upvote 0
I made a module in the personal.xls and saved it. Then I assigned it to the button, it will now sort the workbook not matter the name. Is that easier than your idea Wigi?

Woody
 
Upvote 0
I made a module in the personal.xls and saved it. Then I assigned it to the button, it will now sort the workbook not matter the name. Is that easier than your idea Wigi?

Woody

Do you still use ThisWorkbook in your code for the button in Personal.xls?
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,853
Members
452,948
Latest member
UsmanAli786

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