Create Macro VBA For Sequential Number Printing

DB032788

New Member
Joined
Jul 10, 2024
Messages
1
Office Version
  1. Prefer Not To Say
Platform
  1. Windows
Hello, I am an amateur in Excel at best. I am working to create a document for my receiving department in the supply chain industry. I want to create a controlled numbered document. Using the Fiel I1 as the controlled number, I'd like for a prompt to display to create a document page number range. For Example, I need to print 100 pages of this document, and Control # field needs to increment by 1 on each page. Any assistance is greatly appreciated in getting the code to create an auto prompt when select print to add the page sequencing needed for ongoing use.

Example below. Highlighted field is I1.

1720668502965.png
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hello @DB032788

Try this VBA code:
VBA Code:
Private Sub PrintPages()
   Dim n As Integer, i As Integer
   Dim c As Range
   Set c = Range("I1")
   n = InputBox("How many pages?", "n pages", 1)
   For i = 1 To n
      c.Value = i
      ActiveSheet.PrintOut
   Next i
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