+ Reply to Thread
Results 1 to 8 of 8

Macro works stepping through but not on automation

  1. #1
    Forum Contributor
    Join Date
    10-24-2012
    Location
    Chicago
    MS-Off Ver
    O365
    Posts
    311

    Macro works stepping through but not on automation

    Hello,

    I have the below code that works when I step through it but doesn't work or throw an error when ran. I have changed Selection to Activate and Activesheet to Sheet etc. and it always works stepping through but not on the run. Any suggestions on what I can do to get it working? Thanks in advance for your help!

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Macro works stepping through but not on automation

    Please see the yellow banner at the top of the page.

    Also, describe what you are trying to achieve.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    10-24-2012
    Location
    Chicago
    MS-Off Ver
    O365
    Posts
    311

    Re: Macro works stepping through but not on automation

    The file is attached. The result I am looking for is on the Holiday Pay Final tab to filter on column L for the 0 and delete all lines with zero then unfilter to show the final clean data set. This would be using the DeleteZero macro which is called from when running the BuildFile Macro.
    Attached Files Attached Files

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Macro works stepping through but not on automation

    Try this:

    Please Login or Register  to view this content.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Macro works stepping through but not on automation

    Note:

    H (8) Hours worked
    I (9) Rate of Pay
    J (10) Date Time shift began
    K (11) Date time Shift ended
    L (12) Hours worked

    The example code above filters on column 12, that is, column L (as described in post #3), whereas the code you posted, and in the sample file, filters on column 9, that is, column I. Not sure what you actually want. Looks like the same outcome.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Macro works stepping through but not on automation

    Another Option...
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  7. #7
    Forum Contributor
    Join Date
    10-24-2012
    Location
    Chicago
    MS-Off Ver
    O365
    Posts
    311

    Re: Macro works stepping through but not on automation

    Thanks everyone. This worked. Much appreciated.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Macro works stepping through but not on automation

    This worked.
    What worked?

+ 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. Range Value works sometimes stepping though code
    By sportsguy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-06-2018, 05:43 PM
  2. [SOLVED] Paste Picture Works When Stepping Through (Debug), But Not In Runtime
    By Hello World in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-04-2017, 01:46 PM
  3. Code works fine when stepping through code but Excel freezes if I run it without stepping
    By OldManExcellor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-19-2016, 10:39 AM
  4. Replies: 1
    Last Post: 03-31-2015, 03:01 PM
  5. Open workbook works on stepping but not on execute
    By Wongadob in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-09-2015, 01:33 PM
  6. [SOLVED] Excel-to-eMail Code Works Only When Stepping Through
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2014, 11:19 PM
  7. Code works when stepping through, but cuts out when run
    By Reenen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2005, 07:47 AM

Tags for this Thread

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