+ Reply to Thread
Results 1 to 8 of 8

Assign two macros to a command button, but only one can automatically run!!

  1. #1
    Registered User
    Join Date
    03-14-2012
    Location
    GA, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Assign two macros to a command button, but only one can automatically run!!

    Hi,

    I am trying to use one control button to run the below two macros, i.e., Score1 and hide_rows with the same module. But only the sheets("Score1").Select can automatically run when the control button on the Menu sheet was clicked. Does anybody can help me to fix these? btw, the macro "Score1" have already been assigned to the control button. Many thanks for your kind help and time.

    Paul



    Please Login or Register  to view this content.
    Last edited by paulyb; 03-14-2012 at 10:53 AM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Assign two macros to a command button, but only one can automatically run!!

    Please take a moment to read the forum rules and edit your post to include code tags.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Assign two macros to a command button, but only one can automatically run!!

    Thanks,

    You are already calling the hide_rows macro from the Score1 one so they should both run. Another option is to have a third macro that calls each macro you want to run in order and attach that to the button:

    Please Login or Register  to view this content.
    Dom

  4. #4
    Registered User
    Join Date
    03-14-2012
    Location
    GA, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Assign two macros to a command button, but only one can automatically run!!

    Thank you very much, Dom.

    Yes, I also think the second macro should run at the same time. However, it did not. I will try your suggestion and see whether it can work or not.

    Thanks,

    Paul

    Quote Originally Posted by Domski View Post
    Thanks,

    You are already calling the hide_rows macro from the Score1 one so they should both run. Another option is to have a third macro that calls each macro you want to run in order and attach that to the button:

    Please Login or Register  to view this content.
    Dom

  5. #5
    Registered User
    Join Date
    03-14-2012
    Location
    GA, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Assign two macros to a command button, but only one can automatically run!!

    The second macro ("hide_rows") still cannot run automatically together with the process of the sheets("Score1").Select after I clicked the button that was assigned with Run_All_Macros. Any other suggestions?

    Thanks,

    Quote Originally Posted by Domski View Post
    Thanks,

    You are already calling the hide_rows macro from the Score1 one so they should both run. Another option is to have a third macro that calls each macro you want to run in order and attach that to the button:

    Please Login or Register  to view this content.
    Dom

  6. #6
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Assign two macros to a command button, but only one can automatically run!!

    This might be worth a read: http://www.cpearson.com/excel/debug.htm

    You could step through your code and see whether it is executing as expected or pop a break point in and see if it gets to it.

    Please also don't quote whole posts in your replies.

    Dom

  7. #7
    Registered User
    Join Date
    03-14-2012
    Location
    GA, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Assign two macros to a command button, but only one can automatically run!!

    Still have no idea what's wrong with the codes. Any ones could give me a hint? Appreciate!

  8. #8
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Assign two macros to a command button, but only one can automatically run!!

    Would need to see a sample workbook to have any real idea.

    Dom

+ 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