Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: assign macro?

  1. #1
    New Member
    Join Date
    May 2002
    Posts
    17
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Can someone please tell me how to assign a macro to a command button in Office XP.

    I have looked in the help files which all refer to assigning macros to buttons in the "toolbar" well i dont want that, i want to assign it to a command button... I have been trying to do this for 2 days and i cant see the assign button anywhere

    Please help its frustrating me!

  2. #2
    MrExcel MVP
    Join Date
    Apr 2002
    Location
    Vancouver BC , Canada
    Posts
    6,259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Maybe your refering to some other command button then one from forms tool bar that has been dropped onto the sheet. For these command buttons you just right click on button and then left click on "assign macro" from the drop down menu.

  3. #3
    Board Regular
    Join Date
    Apr 2002
    Location
    Greenwood, SC
    Posts
    677
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    First off, I am assuming you want to assign to a command button you added to a worksheet.

    If the button was placed on the sheet from the Forms toolbar, it should have asked you to assign a macro as soon as you put it there.

    If the button was placed on the sheet from the controls toolbar, you just need to double-click it and it will take you to the VB editor. The sub will be something like:

    Private Sub CommandButton1_Click()

    End Sub

    Cut and paste the code from your macro there.

    P.S. Also assuming you are using Excel 97 or later...

  4. #4
    New Member
    Join Date
    May 2002
    Posts
    17
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    LOL, this is what im reading all the time but when i right click on the button there isnt an assign macro option...

    All there is, is this:

    Cut
    Copy
    Paste
    Properties
    View Code
    commandButton Object
    Grouping
    Order
    Format control



  5. #5
    Board Regular
    Join Date
    Apr 2002
    Location
    Greenwood, SC
    Posts
    677
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You definately have an ActiveX command button. You should be able to either double-click on it or select View Code. This will take you to the VB Editor. Paste your macro inside the Click Event.

    Private Sub CommandButton1_Click()

    Your code here...

    End Sub

    K

  6. #6
    New Member
    Join Date
    May 2002
    Posts
    17
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA *BREATH* HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA

    OMG, I WAS USING THE BUTTON FROM THE CONTROL BOX DOH!

    HOW COULD I HAVE MISSED THAT *FEELS EXTREMLY SILLY AND HIDES UNDER A ROCK*

    THANKS FOR THE HELP LADS

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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