Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Control button / macro
Hi there,
I have a control button on a spreadsheet. And I have a macro already written. How do I attach that macro to the button without having to write or copy the macro code into the control code? I'm really bad at writing that stuff and I think I am messing up the syntax so wondered if there was an easier way. Thanks! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Control button / macro
Le'ts assume your macro is named "myFavoriteMacro" and you want to do
things very, very simply. On your worksheet, double-click the control button. This will pop-up the VBE environment with some code pointing to your command button. It will look something like: Private Sub CommandButton1_Click() End Sub All you need to do is put in the line "Call myFavoriteMacro" before the "End Sub" and you're there. HTH / Tyla / On Feb 10, 5:57 pm, Sarah wrote: Hi there, I have a control button on a spreadsheet. And I have a macro already written. How do I attach that macro to the button without having to write or copy the macro code into the control code? I'm really bad at writing that stuff and I think I am messing up the syntax so wondered if there was an easier way. Thanks! |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Control button / macro
You could, as a possible alternative, create your button from the Forms toolbar.
Right-click and "assign macro". Select your macro by name and OK. Gord Dibben MS Excel MVP On Sat, 10 Feb 2007 17:57:00 -0800, Sarah wrote: Hi there, I have a control button on a spreadsheet. And I have a macro already written. How do I attach that macro to the button without having to write or copy the macro code into the control code? I'm really bad at writing that stuff and I think I am messing up the syntax so wondered if there was an easier way. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help (Uppercase multiple ranges?) | Excel Discussion (Misc queries) | |||
Macro Assigned to a Button | Excel Discussion (Misc queries) | |||
Macro button on toolbar | Excel Discussion (Misc queries) | |||
Assigning macro to button | Excel Discussion (Misc queries) | |||
assign a macro to a control button | Excel Discussion (Misc queries) |