View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Brown Gary Brown is offline
external usenet poster
 
Posts: 178
Default Macro hot button in Spreadsheet

1) Create your macro in the workbook that you want to format. For this
example, we'll call the macro 'MyMacro'.
2) From the Top Menu in Excel, Select ViewToolbarsControl Toolbox
3) Select the 'Command Button' on the Control Toolbox.
4) The cursor becomes a crosshair.
5) Hold down the left-mouse-button and draw your button.
6) Double-click on your button. This will take you to the Visual Basic
Editor (VBE) for the worksheet where you created the button.
7) You'll probably see something like...
Private Sub CommandButton1_Click()

End Sub
8) Type 'Call MyMacro' within the Sub so it looks something like...
Private Sub CommandButton1_Click()
Call MyMacro
End Sub
9) Click on the 'Exit Design Mode' button on the Control Toolbox.
10) 'X' out of the Control Toolbox
11) Done
----------------------------------------
- If you want to change the description on the Command Button, while in
design mode, do this BEFORE Step 6 above.
- Right-click on the button and a menu will appear.
- Select Properties
- The Properties window will appear
- Change the 'Caption' textbox.
- 'X' out of the Properties window
----------------------------------------


--
HTH,
Gary Brown

If this post was helpful to you, please select ''YES'' at the bottom of the
post.



"watchtower" wrote:

How can I create a hot button/key in my spreadsheet and attach a Macro that
will be available to everyone that open it?

For example, I have a formating macro on a shared file. When anyone opens
the file, I would like them to be able to click on a Macro button in some
cell, i.e. G1, which then runs the macro.

Thanks for the feedback.
Adam