I am trying to figure out how to write a sub that will let me take a table of values on one tab, cycle those values through the output sheet printing a report for each row and printing all resulting reports to one PDF. At the moment, my code is printing a separate PDF for each line of output. I am using 2010 Excel/VBA but I fear that the code I am about to post below may be from a much older version of excel (maybe 2003). As it stands, the code is written into a sheet and then a macro button is created and references it. Any help would be greatly appreciated.
[TABLE="width: 747"]
<colgroup><col></colgroup><tbody>[TR]
[TD]PSP Rpts[/TD]
[/TR]
[TR]
[TD]STEP()[/TD]
[/TR]
[TR]
[TD]=ECHO(FALSE)[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]=SET.NAME("CNUM",INPUT("Enter number of copies to be printed.",1,"PSP Reports",1,100,100))[/TD]
[/TR]
[TR]
[TD]=SELECT(!$C$10)[/TD]
[/TR]
[TR]
[TD]=IF(ISBLANK(ACTIVE.CELL()),GOTO(A13))[/TD]
[/TR]
[TR]
[TD]=SELECT("R[1]C")[/TD]
[/TR]
[TR]
[TD]=GOTO(A10)[/TD]
[/TR]
[TR]
[TD]=SET.NAME("NUM",ROW(ACTIVE.CELL())-10)[/TD]
[/TR]
[TR]
[TD]=WORKBOOK.SELECT("PSP Output","PSP Output")[/TD]
[/TR]
[TR]
[TD]=FORMULA.FILL(1,!$T$1)[/TD]
[/TR]
[TR]
[TD]=IF(NUM>!$T$1,GOTO(A19))[/TD]
[/TR]
[TR]
[TD]=SELECT(!$A$1:$S$42)[/TD]
[/TR]
[TR]
[TD]=GOTO(A20)[/TD]
[/TR]
[TR]
[TD]=SELECT(!$A$1:$S$42)[/TD]
[/TR]
[TR]
[TD]=SET.PRINT.AREA()[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]=PRINT(1,1,1,1,FALSE,FALSE,1,FALSE,1)[/TD]
[/TR]
[TR]
[TD]=SET.NAME("CNT",!$T$1+1)[/TD]
[/TR]
[TR]
[TD]=IF(CNT>NUM,GOTO(A27))[/TD]
[/TR]
[TR]
[TD]=FORMULA.FILL(CNT,!$T$1)[/TD]
[/TR]
[TR]
[TD]=GOTO(A16)[/TD]
[/TR]
[TR]
[TD]=SET.NAME("CNUM",CNUM-1)[/TD]
[/TR]
[TR]
[TD]=IF(CNUM>0,GOTO(A15))[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]=WORKBOOK.SELECT("INPUT","INPUT")[/TD]
[/TR]
[TR]
[TD]=SELECT(!$A$1)[/TD]
[/TR]
[TR]
[TD]=RETURN()[/TD]
[/TR]
</tbody>[/TABLE]
The basic functionality is the routine is that it creates an output sheet for each line with values in the "Input" screen. In my particular case, there are 214 lines on the input screen that will produce 214 reports. I would much rather print once to PDF with 214 pages rather than print 214 separate PDF pages that I have to manually name and close out of (since adobe 11 automatically opens the published report). Thanks for any input provided.
[TABLE="width: 747"]
<colgroup><col></colgroup><tbody>[TR]
[TD]PSP Rpts[/TD]
[/TR]
[TR]
[TD]STEP()[/TD]
[/TR]
[TR]
[TD]=ECHO(FALSE)[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]=SET.NAME("CNUM",INPUT("Enter number of copies to be printed.",1,"PSP Reports",1,100,100))[/TD]
[/TR]
[TR]
[TD]=SELECT(!$C$10)[/TD]
[/TR]
[TR]
[TD]=IF(ISBLANK(ACTIVE.CELL()),GOTO(A13))[/TD]
[/TR]
[TR]
[TD]=SELECT("R[1]C")[/TD]
[/TR]
[TR]
[TD]=GOTO(A10)[/TD]
[/TR]
[TR]
[TD]=SET.NAME("NUM",ROW(ACTIVE.CELL())-10)[/TD]
[/TR]
[TR]
[TD]=WORKBOOK.SELECT("PSP Output","PSP Output")[/TD]
[/TR]
[TR]
[TD]=FORMULA.FILL(1,!$T$1)[/TD]
[/TR]
[TR]
[TD]=IF(NUM>!$T$1,GOTO(A19))[/TD]
[/TR]
[TR]
[TD]=SELECT(!$A$1:$S$42)[/TD]
[/TR]
[TR]
[TD]=GOTO(A20)[/TD]
[/TR]
[TR]
[TD]=SELECT(!$A$1:$S$42)[/TD]
[/TR]
[TR]
[TD]=SET.PRINT.AREA()[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]=PRINT(1,1,1,1,FALSE,FALSE,1,FALSE,1)[/TD]
[/TR]
[TR]
[TD]=SET.NAME("CNT",!$T$1+1)[/TD]
[/TR]
[TR]
[TD]=IF(CNT>NUM,GOTO(A27))[/TD]
[/TR]
[TR]
[TD]=FORMULA.FILL(CNT,!$T$1)[/TD]
[/TR]
[TR]
[TD]=GOTO(A16)[/TD]
[/TR]
[TR]
[TD]=SET.NAME("CNUM",CNUM-1)[/TD]
[/TR]
[TR]
[TD]=IF(CNUM>0,GOTO(A15))[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]=WORKBOOK.SELECT("INPUT","INPUT")[/TD]
[/TR]
[TR]
[TD]=SELECT(!$A$1)[/TD]
[/TR]
[TR]
[TD]=RETURN()[/TD]
[/TR]
</tbody>[/TABLE]
The basic functionality is the routine is that it creates an output sheet for each line with values in the "Input" screen. In my particular case, there are 214 lines on the input screen that will produce 214 reports. I would much rather print once to PDF with 214 pages rather than print 214 separate PDF pages that I have to manually name and close out of (since adobe 11 automatically opens the published report). Thanks for any input provided.