Hi
Get your button from the Forms Toolbar, not the Controls Toolbox. For
a Forms Toolbar button, you can right click it and assign your macro.
Your macro should be in a General code module, not the worksheet
module. To create a general module, go into the visual basic editor
and do Insert, Module. Paste your AutoNumber macro into there.
Your code probably does not work because your button is from the
Controls Toolbox. The macro attached here is a button_click event
macro which will go into a specific worksheet code module. All a bit
more complicated than you want.
regards
Paul
On Sep 17, 2:59*pm, Miree <Mi...@discussions.microsoft.com> 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
|