Macro assigning to command button

T

tony robson

Does anyone know how I assign a macro, so that it runs
only when i press a command button I have inserted onto a
spreadsheet & not whenever i press the silly macro smiley
face thing??
 
F

Frank Kabel

Hi
right-click on the Command Button (then in design mode) and choose
'Code'
 
R

Ron de Bruin

Hi Tony

On a button from the Forms Toolbar you can right click and assign a macro

If you have a button from the control toolbox
Press the first button on the control toolbox toolbar to go into the design
mode
Double click on the button you add on your worksheet.
The VBA editor will open with this

Private Sub CommandButton1_Click()

End Sub

You can copy the code in the event or copy the macro name in the event.
Press Alt-q to go back to Excel and press the first button on the
control toolbox again to exit the design mode
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top