View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default command button not working

The simpliest way is to go into Desiign Mode and double click the Control
button. It will create the macro where yo can place you code. to enter
Design Mode

1) Worksheet Menu View - Toolbars - Control Toolbox
2) Press Triangle ICON whic is a toggle button to either Enter or Exit
Design Mode
3) Double click on Your control Button which wil bring you into VBA where
the new macro is created. Past your code into the macro
4) Go back to worksheet and Press Desgin Mode ICON (triangle) to Exit Design
Mode
5) Your control buttonMacro should now operate properly.

"Miree" wrote:

I have a code, which works when i select run but i can not connect it to a
command button, I can get the code to work if i paste in to the work book(but
not the command button) but can not get it to work in the worksheet where
command button is.

Sub AutoNumber()
' AutoNumber Macro
Sheets("Formulations").Select
i = Range("A2") + 1
Sheets("Formulation").Select
Range("E17:E18") = i
End Sub