Assign Macro function

  • Thread starter Thread starter gus
  • Start date Start date
G

gus

Hi!
I've inserted a command button on my spreadsheet and I want to assing a
macro to it, however when I right-click the object, the option "Assign
Macro" is not available. How do I solve that?

Thanks,
Gus
 
Hi Gus.
I've inserted a command button on my spreadsheet and I want to assing a
macro to it, however when I right-click the object, the option "Assign
Macro" is not available.

Possibly it's a command button of the Control ToolBox variety. Do you have a
"View Code" rightclick option?

HTH,
Andy
 
But I don't know how to assign a macro this way. Any clue?

Select the View Code option, you'll be transported to the Visual Basic
Editor. Excel will give you a head start with something like

Private Sub CommandButton1_Click()

End Sub

, whatever you want the button to do (e.g. MsgBox "Hi!") goes between the
lines. Tho' when you switch back to Excel proper, make sure you Exit Design
Mode (first icon/button on the Control ToolBox).

Rgds,
Andy
 
Perfect, Andy!
I'll create a macro separately, and then I'll copy/paste the code.
Thanks so much!

Gus
 
Back
Top