Create Macro Button

AllenL

Board Regular
Joined
Mar 14, 2002
Messages
67
I have a VBA code and I want the code to be run by different workbooks separately and not depend on other workbook.
I've created a button in a toolbar to run the code. However, the button depends on the workbook which the code is last assigned.
Is there a way to create the button so the macro can run on each workbook separately??

Please Help
Thanks in advance
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi Mate


I would suggets a switchboard.. thats a userform to Excel users,, assign whatever you nne to each command button and just one icon on tool bar pulls up userform.. the worlds you oyster then......
 
Upvote 0
Are you saying that I should create 8 buttons if I have 8 workbooks and assign the macro to those 8 buttons according to those workbooks?
Sorry I don't think I really get your answer.
Can you explain a little bit more please
Thanks in advance
 
Upvote 0
/////I have a VBA code and I want the code to be run by different workbooks separately and not depend on other workbook.

OK a button for each might not be ideal but give 100% control over things...

.......I've created a button in a toolbar to run the code.

Assign this to pull up the userform ....

///////However, the button depends on the workbook which the code is last assigned.

This method matter little you choose which to run REGARDLESS thus 100% control.. makes the code sdmall and bitty but editable easly.

////Is there a way to create the button so the macro can run on each workbook separately??

Of casue as you say assign as many command buttons to each shhet as needed 1 or 100 matters not.. i even have buttons to pull up dioalog which mention storys of old pals and dead friends.. in memory .. you can do as you please from user form.. add bits and snips as you want.. easy work once you get the hang..

Click toolbar

up pops user form select code to execute...

Thats it... Name each button for ease of reference....
 
Upvote 0

Forum statistics

Threads
1,214,385
Messages
6,119,208
Members
448,874
Latest member
b1step2far

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