ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Imbedded buton to run macro? (https://www.excelbanter.com/excel-programming/393884-imbedded-buton-run-macro.html)

Fritz

Imbedded buton to run macro?
 
I run XL2003
I have designed a button embedded in my worksheet.
I want my new button to run a macro which I recorded.

How do I assign a specific macro to a specific button?

I don't want to customize a button on a menu!


Fritz

Imbedded buton to run macro?
 
Of and running

"Fritz" wrote:

I run XL2003
I have designed a button embedded in my worksheet.
I want my new button to run a macro which I recorded.

How do I assign a specific macro to a specific button?

I don't want to customize a button on a menu!


SeanC UK[_2_]

Imbedded buton to run macro?
 
Hi Fritz,

You already have the button embedded, so go into Design Mode (on the Visual
Basic toolbar - I expect you are already there considering you have the
button). Then just double click that button and the Visual Basic editor
should open in the worksheet module in the Click Event of the button that you
created:

Private Sub myButton_Click()

End Sub

You can either write your macro code in this sub, or call your macro from it:

Private Sub myButton_Click()
myMacro
End Sub

If your macro is contained in another module, make sure it isn't declared as
Private, or the call from the Worksheet module won't find it. I think, by
default, recorded macros aren't declared and are therefore public anyway.

"Fritz" wrote:

I run XL2003
I have designed a button embedded in my worksheet.
I want my new button to run a macro which I recorded.

How do I assign a specific macro to a specific button?

I don't want to customize a button on a menu!



All times are GMT +1. The time now is 11:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com