ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA - Loop a Function (https://www.excelbanter.com/excel-programming/361624-vba-loop-function.html)

[email protected][_2_]

VBA - Loop a Function
 
I have the current function:

Sub Printing()
Sheets(ActiveSheet.Index + 1).Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

I then want the formula to restart itself on teh current sheet and then
move the next sheet and print the data and so and so on (I have 300
sheets that need to be printed individually to maintain the correct
page numbering).

Thanks for the help.

Scott


Tom Ogilvy

VBA - Loop a Function
 
Sub Printing()
for i = 1 to 300
Sheets(i).Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Next i
End Sub

--
Regards,
Tom Ogilvy



" wrote:

I have the current function:

Sub Printing()
Sheets(ActiveSheet.Index + 1).Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

I then want the formula to restart itself on teh current sheet and then
move the next sheet and print the data and so and so on (I have 300
sheets that need to be printed individually to maintain the correct
page numbering).

Thanks for the help.

Scott



[email protected][_2_]

VBA - Loop a Function
 
Thanks Tom.



All times are GMT +1. The time now is 01:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com