Where "F1" is the button you're assigning the macro to and "UnHide" is
the name of the macro. Lookup "OnKey" in VBA Help for a list of the
keys names to use. - Pikus
View>Toolbars in the Menu bar
Check Forms or Control Toolbox
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 placed on your worksheet.
The VBA editor will open with this
Private Sub CommandButton1_Click()
End Sub
You can place the code in the event or place the macroname 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
CommandButton1 is to a key. If you want a key on your keyboard to call
the macro you need to use the name of that key. Looking up OnKey in
Help will give you a good list to use, though it isn't exhaustive. If
however you want a button to run some code, enter design mode and right
click and select "View Code" from the menu. Just paste the code itself
into the window that pops up or you can call the macro using "Call".
Private Sub CommandButton1_Click()
Call Macro1
End Sub
Let me know if you have any more problems. - Pikus
Or you can just insert a picture or drawing which can be formatted not to
print,
and assign a macro to it by right clicking on the border and select "assign
macro............."
The drawing can be a simple square or circle.
regards
Bill K
Pikus,
The OP never mentioned the word Key. In his original post he asked about
assigning a macro to a button. You are the one that described how to run a
macro from a shortcut key.
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.