Tech Support Guy banner

Creating a Macro in Excel: Date by addition when printing

1010 Views 2 Replies 2 Participants Last post by  Keebellah
Good Morning,
I am attempting to create a print preview, and then a printing button for one of my documents. I figured out how to do a basic print preview and then print when approved. If possible, I would like to create 5 copies (currently just pressing the button 5 times) and on each consecutive copy, have the date increase by one. I have the start date for printing appearing on a sheet called "WT" in cell C1 and would like it to appear in cell H1 for the worksheets ending in "SI" and then in cell AJ4 in worksheets ending in "TS". Not sure if this is possible, but any help would be greatly appreciated. I posted my current VPN coding for previewing and then printing these lists, but if you could help with one, I'm pretty sure I could figure out the other. Just please let me know if there are any changes in the "printout" phrases, please.
Thanks for your help in advance

Sub PrintPreviewCrewLists()
Worksheets(Array("A SI", "A TS", "B SI", "B TS")).PrintOut Preview:=true
For i = 1 To 5
Range("H1") = Range("H1") + 1
ActiveWindow.Worksheets(Array("A SI","B SI")).PrintPreview Copies:=1
Next i
For i = 1 To 5
Range("AJ4") = Range("AJ4") + 1
ActiveWindow.Worksheets(Array("A TS", "B TS")).PrintPreview Copies:=1
Next i
End Sub

Printing macro has not been updated as I have not figured out how to preview it successfully.

Sub PrintCrewLists()
Worksheets(Array("A SI", "A TS", "B SI", "B TS")).PrintOut
End Sub
Status
Not open for further replies.
1 - 3 of 3 Posts
Hi, you write a loop that runs 5 times, something like this

Code:
Sub PrintFiveTimes()
Dim pLoop as Integer
for pLoop = 1 to 5
     Range("H1") = Range("H1") + 1
    ActiveWindow.Worksheets(Array("A SI","B SI")).PrintPreview Copies:=1
   Range("AJ4") = Range("AJ4") + 1
   ActiveWindow.Worksheets(Array("A TS", "B TS")).PrintPreview Copies:=1
next pLoop
End Sub
I don't know why the preview, but...
1 - 3 of 3 Posts
Status
Not open for further replies.
Top