+ Reply to Thread
Results 1 to 7 of 7

Run a macro from a command button

  1. #1
    Registered User
    Join Date
    12-13-2009
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    12

    Run a macro from a command button

    I have created a command button from the Excel 2003 from the Macros toolbar that I placed on my worksheet. I want to use this button to activate an existing macro. Currently I have no code entered for this button and the button when clicked on behaves as an object to be edited, moved, etc. How should I proceed?
    Last edited by Dave7554; 12-20-2009 at 11:07 AM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,317

    Re: Run a macro from a command button

    Did you right click on the button and select view code?

  3. #3
    Registered User
    Join Date
    12-13-2009
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Run a macro from a command button

    Yes, there is no code written in the button macro. The button was created after I wrote the macro.

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Run a macro from a command button

    If you would have an Active X commandbutton and you would dbl click it you would see this
    Please Login or Register  to view this content.
    Assume your macro is called macro1 and it resides in Module1 then you need to place this in between
    Please Login or Register  to view this content.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  5. #5
    Registered User
    Join Date
    12-13-2009
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Run a macro from a command button

    I wrote the code as suggested. How do I get the button to behave correctly? It still behaves as an editable object.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,317

    Re: Run a macro from a command button

    Maybe check to ensure the design mode is toggled off

  7. #7
    Registered User
    Join Date
    12-13-2009
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Run a macro from a command button

    Thanks. That worked.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1