+ Reply to Thread
Results 1 to 2 of 2

Macro runs correctly when run from Editor, but not from Command Button??

  1. #1
    Forum Contributor
    Join Date
    08-22-2013
    Location
    USA
    MS-Off Ver
    MS Office for Office 365 (Latest - 32-bit)
    Posts
    107

    Macro runs correctly when run from Editor, but not from Command Button??

    Hi,

    This is very strange. I have this code within a larger macro to insert blank rows after subtotals:

    Please Login or Register  to view this content.
    When I run the entire Macro from the VBA Editor window, everything works correctly, including the insert rows after subtotals portion of it.

    However, I have a Command Button set up as well, it looks at checkboxes to determine which Macro should be run. When I check the "Jan" checkbox and hit the Command Button, it performs the entire macro successfully EXCEPT for the portion where it's supposed to insert rows after subtotals. That part of the macro is in the middle of the larger macro, so it's like it's skipping that part??

    Here is the code for the Command Button for reference: (Jan is Checkbox1).

    Please Login or Register  to view this content.
    Any ideas why it's skipping that one part of the larger macro when using the Command Button?

    Thanks.

  2. #2
    Forum Contributor
    Join Date
    08-22-2013
    Location
    USA
    MS-Off Ver
    MS Office for Office 365 (Latest - 32-bit)
    Posts
    107

    Re: Macro runs correctly when run from Editor, but not from Command Button??

    Never mind, figured it out. The Jan sheet has to be the active worksheet for the subtotal function to work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Command button with macro does not work correctly
    By c_spooner1999 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-01-2013, 11:22 AM
  2. [SOLVED] code behind the command button that runs another macro
    By Vogelmann in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-10-2012, 06:04 AM
  3. Making a command button fit correctly.
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2011, 10:27 AM
  4. VB editor appears when command button activated
    By arkydave in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2011, 06:56 AM
  5. Excel - keep a command button from moving after code runs?
    By Dave Little in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2005, 10:05 AM

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