
Originally Posted by
jimmisavage
Hi everyone,
Just a quick question.
I have recorded a macro, all fine. Now i was wondering if i could use a button (which i put on an excel sheet) to run the recorded macro. (rather that 'Ctrl + A' for instance).
Have control tool box visible. (View>Toolbars>Control Tool Box ). In the tool box. There is a button. Click on this and then drag and draw a button of required size. If this is the first button its caption would br CommandButton1. Double click on this button. It will directly take you to code sheet of sheet1 ( if you are on sheet1 ). It opens a blank sub named commandbutton1_click which you can edit. Code for your recorded macro would normally be on standard module1 sheet. If name of the macro you recorded is say macro1 then just add a line in the sub and your sub should read
Private sub commandbutton1_click()
macro1
end sub
come back to the excel sheet. On the control tool box click exit design mode. You are ready to go. Clicking the button runs the sub which calls macro1.
A V Veerkar
Bookmarks