Printing an incrementing table value for each print

DThib

Active Member
Joined
Mar 19, 2010
Messages
464
Office Version
  1. 365
Platform
  1. Windows
Hi,
I am trying to figure code to take a column of numbers (1-27) and when printed move the entire set to (28-55), etc.
The form is printed, and these numbers would be the line count for each sheet.

No idea how to start coding this, help!!!!!
 
Where are these 26 rows? Are they on sheet 1, 2, 3 etc, what is the sheet name? Are they in column A, B, C etc? How many columns are included?


What next sheet? Is the print range moving down the sheet, is it moving to the next worksheet tab, is it staying in the same place on the same sheet and the data is moving somewhere else or being deleted?

When I asked for specific details, this is what I meant... I can't help if you just keep giving me vague descriptions. I know it makes sense to you, but I know absolutely nothing of your data and what it looks like.
So here is the sheet. Column G is the RR #. The Excel has one sheet at the moment, and it will be QA controlled.
View attachment 105919
This sheet will be printed out.
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Where are these 26 rows? Are they on sheet 1, 2, 3 etc, what is the sheet name? Are they in column A, B, C etc? How many columns are included?


What next sheet? Is the print range moving down the sheet, is it moving to the next worksheet tab, is it staying in the same place on the same sheet and the data is moving somewhere else or being deleted?

When I asked for specific details, this is what I meant... I can't help if you just keep giving me vague descriptions. I know it makes sense to you, but I know absolutely nothing of your data and what it looks like.
The column that holds the RR number is G. There is only one (1) sheet in the workbook for now. It is a QA controlled document. The sheet will be printed out for use.
1706549891666.png

26 rows. Column G would revise the number to the new value after printing.
 
Upvote 0
The column that holds the RR number is G. There is only one (1) sheet in the workbook for now. It is a QA controlled document. The sheet will be printed out for use.
View attachment 105921
26 rows. Column G would revise the number to the new value after printing.
Do you want the macro to trigger the print or have the macro trigger after the print?
 
Upvote 0
Do you want the macro to trigger the print or have the macro trigger after the print?
After the print, the macro could fill the next series of numbers. That way the control will be the number of pages printed.
 
Upvote 0
After the print, the macro could fill the next series of numbers. That way the control will be the number of pages printed.
So, if you were to print 5 copies at once, you would want each copy to have a unique range of report numbers?
 
Upvote 0
Yes, the RR number follows the item as its record.
It may be easiest to have the macro control the print so that the code can run between each copy. I am not sure if the code can intercept the printing between each copy once the command is sent to the printer if you want more than 1 at a time.
 
Upvote 0
It may be easiest to have the macro control the print so that the code can run between each copy. I am not sure if the code can intercept the printing between each copy once the command is sent to the printer if you want more than 1 at a time.
That would work, thank you
 
Upvote 0
That would work, thank you
Okay, give this a try:

This assumes the last line is always G29, if that is not accurate, let me know and it can be adjusted. The user will be prompted to enter the number of copies to print, then print the first copy, renumber the list, print the second, renumber, print, etc.

VBA Code:
Sub PrintReports()
Dim repNum As Long, copyNum As Long, i As Long, j As Long
repNum = Right(Range("G29").Value, 6) + 0
copyNum = InputBox("Number of copies to print:", "Print Copies")

For j = 1 To copyNum
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
    For i = 3 To 29
        repNum = repNum + 1
        Range("G" & i).Value = "RR " & Format(repNum, "0#####")
    Next i
Next j
End Sub
 
Upvote 0
Solution
Okay, give this a try:

This assumes the last line is always G29, if that is not accurate, let me know and it can be adjusted. The user will be prompted to enter the number of copies to print, then print the first copy, renumber the list, print the second, renumber, print, etc.

VBA Code:
Sub PrintReports()
Dim repNum As Long, copyNum As Long, i As Long, j As Long
repNum = Right(Range("G29").Value, 6) + 0
copyNum = InputBox("Number of copies to print:", "Print Copies")

For j = 1 To copyNum
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
    For i = 3 To 29
        repNum = repNum + 1
        Range("G" & i).Value = "RR " & Format(repNum, "0#####")
    Next i
Next j
End Sub
Thank you!!!
It work. QA will be happy.
 
Upvote 0

Forum statistics

Threads
1,215,139
Messages
6,123,263
Members
449,093
Latest member
Vincent Khandagale

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