Can Excel change numbers in a cell upon printing?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have to print my blank Purchase Orders out of Excel. Is there a way to have the P.O. Number add one to it for every page printed? Now I manually change it and print one then change it and print one.
 
Wendy,

Sure it can.
An InputBox would probably be the best way to go.
Try the following code:

Sub TestMe()
Dim HowMany As Integer
Dim StartNum As Integer
If Range("A1").Value = "" Then Range("A1").Value = 1
HowMany = InputBox("How many Invoices to print starting at " &
Range("A1").Value)
StartNum = Range("A1").Value
Dim i As Integer
For i = StartNum To StartNum + HowMany - 1
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("A1").Value = Range("A1").Value + 1
Next i
End Sub

The above assumes that the cell to increment is "A1" (modify to suit)
You may have to play with the +1, -1 a little, but this should work.

John


Wendy said:
I have to print my blank Purchase Orders out of Excel. Is there a way to
have the P.O. Number add one to it for every page printed? Now I manually
change it and print one then change it and print one.
 
Back
Top