Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
BorisS
 
Posts: n/a
Default assigning macro to button

In versions before 03, I remember there was a way to simply assign a macro to
a button that was created. Now I cannot tell how to do it. I have used the
control toolbar to create the toolbar and I have a macro, but I don't know
how to assign it.
--
Boris
  #2   Report Post  
Rowan
 
Posts: n/a
Default

When you create the button from the Controls Toolbox it will be in
design mode. Double clicking it should take you to the default event for
the button i.e. the sheet module for the relevant worksheet with code eg:

Private Sub CommandButton1_Click()

End Sub

Change this to

Private Sub CommandButton1_Click()
Call MyMacro 'your macro name
End Sub

Alternately, use a button from the Forms Toolbar. Right click the button
and select Assign Macro.

Hope this helps.
Rowan

BorisS wrote:
In versions before 03, I remember there was a way to simply assign a macro to
a button that was created. Now I cannot tell how to do it. I have used the
control toolbar to create the toolbar and I have a macro, but I don't know
how to assign it.

  #3   Report Post  
BorisS
 
Posts: n/a
Default

thanks. I forgot it was the forms toolbar that let me make the button I
wanted.
--
Boris


"Rowan" wrote:

When you create the button from the Controls Toolbox it will be in
design mode. Double clicking it should take you to the default event for
the button i.e. the sheet module for the relevant worksheet with code eg:

Private Sub CommandButton1_Click()

End Sub

Change this to

Private Sub CommandButton1_Click()
Call MyMacro 'your macro name
End Sub

Alternately, use a button from the Forms Toolbar. Right click the button
and select Assign Macro.

Hope this helps.
Rowan

BorisS wrote:
In versions before 03, I remember there was a way to simply assign a macro to
a button that was created. Now I cannot tell how to do it. I have used the
control toolbar to create the toolbar and I have a macro, but I don't know
how to assign it.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning macro to button d Excel Discussion (Misc queries) 0 August 22nd 05 01:40 PM
How do I Assign Macro to a button? BellExcel Charts and Charting in Excel 4 May 20th 05 07:21 PM
2 part question - macro / command button John Excel Discussion (Misc queries) 3 April 16th 05 09:00 PM
Assigning a macro to a "button" Yvon Excel Discussion (Misc queries) 6 February 8th 05 10:58 PM
How to assign a macro to a commnd button Mickey Blue Eyes Excel Discussion (Misc queries) 2 January 4th 05 02:15 PM


All times are GMT +1. The time now is 07:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"