Results 1 to 13 of 13
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Assign a Macro to a Button (Excel 2000)

    Hi,
    This is a stupid question but I cannot find the answer, I want to assign a macro to a button, I have done it in a previous version, in Excel 2000 I cannot see any option to assign the macro. What have I missed. I created the button from the toolbar, I even read the Help

  2. #2
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Missouri, USA
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    Bring up the "Customize toolbar" (Menu > Tools > Toolbars > Customize). Then you should be able to right-click on the button and at the bottom should be a menu item "Assign macro..." Is it not there?

    If it is, then releasing the mouse will bring up the macro listing box. Select the one you want and click okay. The box will disppear. Then close the customize toolbar dialog box.

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    Here's the screenshot I was obsessively working on until rudely called on to do actual work, during which time Shades beat me to it. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Attached Images Attached Images
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    Perhaps you mean a command button from the Control Toolbox, in which case you cannot directly assign a macro. When you add such a button to a worksheet you can right click on it and select View Code. You should then be presented with the following two lines,

    Private Sub CommandButton1_Click()

    End Sub

    between which you can type the name of the macro you wish to invoke, assuming it is a Public Sub.

    Or alternatively you can use a button from the Forms toolbar, to which you can directly assign a macro.

    Andrew C

  5. #5
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    Hi Guys,

    Thanks for the info but this is not what I need, what I need to do is put a command button on a sheet and assign the macro to that button, not one on the toolbar.

    Thanks

    Mike

  6. #6
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    Hi Andrew,

    This is what I want to do, but I have always assigned the macro to the button, I have many examples of this, has it changed for Excel 2000.

    Regards

    Mike

  7. #7
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    The command button in the FORMS toolbar has an "assign macro" item. The one in CONTROLS toolbox is done throough a click event.

    Steve

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    I would advise to use the button from the forms toolbar, it is simpler the the one from the control toolbox (which is more fancy though)
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  9. #9
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    Thanks Jan

    I need to put it on the sheet as I have to give this to a user and do not want to go around setting up buttons on tool bars.

    Regards

    Mike

  10. #10
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    The command buttons on the FORMS toolbar can be added to the worksheet.
    Steve

  11. #11
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    Thanks Jan,

    I missed read what you said, I have now used the Forms button and it does what need.

    Many thanks

    Mike

  12. #12
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    Hi Steve,

    This is where it is, many thanks.

    Regards

    Mike

  13. #13
    3 Star Lounger
    Join Date
    Nov 2001
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Assign a Macro to a Button (Excel 2000)

    Thanks Jan

    I need to put it on the sheet as I have to give this to a user and do not want to go around setting up buttons on tool bars.

    Regards

    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •