Auto increment print function

babyburk

New Member
Joined
Dec 17, 2008
Messages
43
Office Version
  1. 365
Platform
  1. Windows
I am doing the same type of thing as this here: Auto increment on print function.
Printing PO books. I want to print 001 through 050 this time. But the next time I print them, I want to start from 051 to 100. Not start from 001 again. So, how do I tell it what number to start at?
 
Last edited by a moderator:
Ok. I think I have something wrong. My guess is the value "s".

Sub PrintInvoice()
Dim x As Integer
Dim c As Variant
c = InputBox("STARTING NUMBER")
Range("R5") = s
c = InputBox("NUMBER OF COPIES", "PRINT")
For x = 1 To c
Range("R5") = Range("R5") + 1
Sheet1.PrintOut
Next x
MsgBox "DONE PRINTING", vbOKOnly, "PRINT COMPLETED"
End Sub
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Where is "s" being set?

I believe this line:
Rich (BB code):
c = InputBox("STARTING NUMBER")
should be this:
Rich (BB code):
s = InputBox("STARTING NUMBER")
 
Upvote 0
So, now it shows the numbers move on the screen but the print is just the ending number. I am testing it by printing just 2 pages. I start with 1000 and I can see is cycle to 1001 and 1002 but the two print out pages only say 0002 on them. I assume it has something to do with "For x = 1 To c" staring the printing from 0001. I'm thinking that the "1" needs to be the starting number "s". I tried to change it to "s" but doesn't work.

Sub PrintInvoice()
Dim x As Integer
Dim c As Variant
s = InputBox("STARTING NUMBER")
Range("R5") = s
c = InputBox("NUMBER OF COPIES", "PRINT")
For x = 1 To c
Range("R5") = Range("R5") + 1
Sheet1.PrintOut
Next x
MsgBox "DONE PRINTING", vbOKOnly, "PRINT COMPLETED"
End Sub
 
Upvote 0
I don't understand. If you need to go from 1001 to 1002, where is the 0002 coming from?
I think some key details may be being left out, and there may be more to this than you are telling us here.
 
Upvote 0
Even though I am putting 1000 as the starting number, it is starting from 0000.
 
Upvote 0
Even though I am putting 1000 as the starting number, it is starting from 0000.
Are you saying that is what it is doing, or that is what it should be doing?

Note that "0000" itself is NOT a valid number, as leading zeroes are dropped from valid numbers.
If you see something like "0000", then either you have some sort of Custom format being applied, or there is some type of conversion going on.
So sounds like you many have other stuff going on here that you have not disclosed to us here.
 
Upvote 0
This is what it is doing. It should start from the starting number entered. If 4567 is entered then the first print should be 4568 then 4569 etc. for how sheets is entered.
 
Upvote 0
OK, your question has gotten so far away from the original question, I have moved it to its own thread (as it really should have been its own thread all along).

There is so much that you are not providing that we need answered. I think it would probably best is you could upload a desensitized version of your workbook up to a file sharing site and provide the link here, so we can download/see it for ourselves, and look at all the details that we need to fully understand what is going on and how this is currently working.
 
Upvote 0
I am missing something. The prints do not start with the number I have entered. They only are printing out "0002" on all sheets. So, it is also not counting up one per print. however, the file does increase the number of copies that I specified. This is what I have now:

Sub PrintInvoice()
Dim x As Integer
Dim c As Variant
c = InputBox("STARTING NUMBER")
Range("R5") = c
c = InputBox("NUMBER OF COPIES", "PRINT")
For x = 1 To c
Range("R5") = Range("R5") + 1
Sheet1.PrintOut
Next x
MsgBox "DONE PRINTING", vbOKOnly, "PRINT COMPLETED"
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top