+ Reply to Thread
Results 1 to 5 of 5

Macro Works When Stepping Through, Printing First Iteration Blank (Skips Steps)

  1. #1
    Registered User
    Join Date
    02-23-2023
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Office 365
    Posts
    2

    Macro Works When Stepping Through, Printing First Iteration Blank (Skips Steps)

    Cross-posted at https://www.mrexcel.com/board/thread...auses.1230705/

    I am trying to auto populate two different forms to be printed via an OrderNo entered in a cell on JobCover sheet. The sheet also has a cell for JobNo which gets automatically populated from the macro below. When I manually step through the macro, it runs great; however, when I run it by clicking the macro button on the JobCover sheet, it does not work properly. I am using a PDF printer for testing. It prints a blank sheet for the first iteration and everything else after the first one prints normal. Another issue is, if I switch my default printer to a physical printer, it will not print anything. I really need to get this working ASAP!!!
    I also had an issue previously in which it seemed as if it was running too fast and would not populate fields properly. As if it was skipping steps. I disabled background refresh on all the queries and that seemed to help some. I then noticed a similar issue and added pauses randomly in the code to try and slow it down. I am doing something wrong.
    I have the following sheets on this spreadsheet:

    Job TT & Full Kit
    ? This is sheet the macro is printing. There are multiple cells with VLOOKUPS that get populated from the JobCover sheet, JobInfo sheet. Also Job # on this sheet is referenced as =JobCover!$B$1
    JobCover
    ? This sheet has a cell in which the order number is entered which runs a query on the OrderInfo sheet as a result of the input. There is also a cell that gets populated with the Job Number (the loop in the macro populates this automatically).

    JobInfo
    ? Populated from Job Number input on JobCover sheet

    OrderInfo
    ? Populated from OrderNumber input on JobCover sheet

    OpenJobData
    ? This is a query that gets updated via the macro. It is all open job data from our ERP system.

    JobPivot
    ? PivotTable1 has data from the JobInfo sheet. There is also separate columns of non-pivot data that reference PivotTable1 and have calculated fields from the referenced info. There are multiple Vlookups on the Job TT & Full Kit sheet that reference this.

    OpenJobDataPivot
    ? PivotTable2 pulls info from the OpenJob table on the OpenJobData sheet. The PivotTable2 data is referenced on the JobPivot sheet non-pivot table columns.

    Holidays
    ? Lists company holidays for use in the WORKDAY.INTL function on the JobPivot sheet

    Here is the Macro:
    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 02-23-2023 at 11:27 AM. Reason: added xpost link

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,709

    Re: Macro Works When Stepping Through, Printing First Iteration Blank (Skips Steps)

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    I have added the link because it's your first post. Please read the rules before posting further.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,709

    Re: Macro Works When Stepping Through, Printing First Iteration Blank (Skips Steps)

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

  4. #4
    Registered User
    Join Date
    02-23-2023
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Macro Works When Stepping Through, Printing First Iteration Blank (Skips Steps)

    I apologize for the double post. I did not realize the different forums were connected as they were different websites.

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,709

    Re: Macro Works When Stepping Through, Printing First Iteration Blank (Skips Steps)

    They are not connected. If you post to two different websites, that means you have two different groups of people trying to solve your problem at the same time. If it is solved on one website, the people on the other website don't know about it and will continue to waste their time developing a solution that you already have. When you provide a link here, we can check the other site to see if you have responses yet.

    The other site you posted to also has the same rule. In fact, most sites have this rule.

+ 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] Macro works stepping through but not on automation
    By amartin575 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-03-2022, 01:45 PM
  2. Copying data from Excel to PowerPoint skips steps
    By Jstns in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2020, 12:28 PM
  3. Run an entire loop instead of iteration by iteration when stepping into code?
    By Norcal1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2019, 04:20 PM
  4. 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
  5. [SOLVED] Macro that rounds but skips cells if blank
    By Hood in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-19-2016, 07:28 PM
  6. 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
  7. Macro for inserting rows w/ data works fine for 4iterations, but skips updates in 5th
    By koushik_s in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2015, 10:45 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