Automatic sequential number when printing

Kym_beginner_in_VBA

New Member
Joined
May 21, 2022
Messages
10
Office Version
  1. 365
Platform
  1. Windows
I have a single sheet in excel where in one cell the number will always start with '1' and i want to print many copies of that page with other bits of info on a weekly basis, but sometimes i only need 10 copies and other times i need 90 copies.
all i want to know if is there is a code or something i can put in the cell of that sheet so when i print 20 copies, that 1 cell only increases by +1 with each copy.
the number i need increasing is the number labeled as 'BAG NO:'
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I believe that you would need a macro to do what you want. Change the range (in red) to match the cell that contains the "1". Then delete the "1" so that the cell is empty. When you run the macro, you will be prompted to enter the number of copies to print.
Rich (BB code):
Sub PrintCopies()
    Application.ScreenUpdating = False
    Dim x As Long, count As String
    count = InputBox("Please enter the number of copies to print.")
    If count = "" Then Exit Sub
    For x = 1 To count
        With ActiveSheet
            .Range("A1") = .Range("A1") + x
            .PrintOut
            .Range("A1") = ""
        End With
    Next x
    Application.ScreenUpdating = True
End Sub
 
Upvote 1
Solution
I believe that you would need a macro to do what you want. Change the range (in red) to match the cell that contains the "1". Then delete the "1" so that the cell is empty. When you run the macro, you will be prompted to enter the number of copies to print.
Rich (BB code):
Sub PrintCopies()
    Application.ScreenUpdating = False
    Dim x As Long, count As String
    count = InputBox("Please enter the number of copies to print.")
    If count = "" Then Exit Sub
    For x = 1 To count
        With ActiveSheet
            .Range("A1") = .Range("A1") + x
            .PrintOut
            .Range("A1") = ""
        End With
    Next x
    Application.ScreenUpdating = True
End Sub
Thank you, yes that worked. is there a quick button to run the macro when the page is open
 
Upvote 0
You could insert a shape on the worksheet and assign the macro to it. When you click the shape, the macro will run.
 
Upvote 0
You could insert a shape on the worksheet and assign the macro to it. When you click the shape, the macro will run.
Yes i googled it and it was real easy to set up so I have a working sheet and no more printing 1 by1 or adding numbers by hand to a blank page. thank you kindly for your code
 
Upvote 0

Forum statistics

Threads
1,223,880
Messages
6,175,154
Members
452,615
Latest member
bogeys2birdies

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