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:
Bookmarks