Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

How to auto increment cell value after each printing?

Author Xiaoyang Last modified

In many business and administrative workflows, there may be a need to print out multiple copies of a document, invoice, or check, each labeled with a unique serial number or identifier for easy record-keeping and tracking. For example, imagine you have an Excel worksheet formatted as a check or voucher template, and cell A1 contains a check number such as "Company-001". When you print 100 copies of this page, it would be tedious and error-prone to manually update the number for each individual printout. Ideally, you would want Excel to automatically increment the value in cell A1 for each print action, so the first print shows "Company-001", the second "Company-002", and so on, up to "Company-100".

By default, Excel does not provide a built-in feature to automatically increase a cell value after each print job. However, you can achieve this automation with the help of a VBA macro. Using VBA is a practical solution if you need to efficiently generate consecutively numbered hard copies, especially when working with serial forms, tickets, checks, or any scenario requiring unique identifiers for printed pages. This approach helps avoid manual errors, saves time, and guarantees each copy receives a unique number as needed.

Below, we introduce a VBA method to auto-increment cell values for each printed copy. Additionally, this article offers guidance on effective usage, potential caveats, and practical tips for optimizing batch printing tasks in your Excel workflow.

Auto increment cell value after each printing with VBA code


arrow blue right bubble Auto increment cell value after each printing with VBA code

There is no direct, native Excel option for auto-incrementing a cell value with every printout. To automate this process, you can use a VBA macro to efficiently print out a specified number of copies, each with an incremented identifier in cell A1. This method is especially suited for generating personalized hard copies (such as checks, labels, forms, etc.) with sequential numbering. Please note that using macros may require enabling macros within your Excel environment, and running VBA code can affect file security settings. Always make sure to save your work before running any code.

1. Hold down the ALT + F11 keys together to open the Microsoft Visual Basic for Applications window. If this is your first time using VBA, you might need to enable the Developer tab in your Excel ribbon.

2. In the VBA editor, click Insert > Module to open a new module window. In the new module, copy and paste the VBA code provided below. This script will help you increment the printout number for every copy you print from the active worksheet.

VBA code: Auto increment cell value after each printing:

Sub IncrementPrint()
'updateby Extendoffice
    Dim xCount As Variant
    Dim xScreen As Boolean
    Dim I As Long
    On Error Resume Next
LInput:
    xCount = Application.InputBox("Please enter the number of copies you want to print:", "Kutools for Excel")
    If TypeName(xCount) = "Boolean" Then Exit Sub
    If (xCount = "") Or (Not IsNumeric(xCount)) Or (xCount < 1) Then
        MsgBox "error entered, please enter again", vbInformation, "Kutools for Excel"
        GoTo LInput
    Else
        xScreen = Application.ScreenUpdating
        Application.ScreenUpdating = False
        For I = 1 To xCount
            ActiveSheet.Range("A1").Value = " Company-00" & I
            ActiveSheet.PrintOut
        Next
        ActiveSheet.Range("A1").ClearContents
        Application.ScreenUpdating = xScreen
    End If
End Sub

This code prompts you for the total number of copies you wish to print, handles the updating of cell A1 for each print cycle, and prints each version automatically.

3. After pasting the code, make sure your worksheet is ready and the active cell (typically A1) contains the correct base text (like "Company-001"). Press the F5 key or click Run in the VBA editor to start the macro. A prompt box will appear asking how many copies you wish to print; enter the number desired (for example, 100) and confirm the input. Please see the interface screenshot below for reference:

A screenshot of a prompt box asking for the number of copies to print with incremented numbers

If you input a non-numeric value or click Cancel, the process will stop with no action. Ensure you only enter numbers and double-check the starting value in cell A1 before proceeding.

4. Click the OK button. The macro will now automatically print the worksheet the specified number of times, adjusting the sequence in cell A1 each time so that each printed page is numbered in order (e.g., Company-001, Company-002, Company-003, ... up to Company-100, depending on your input and the formatting in the macro).

Additional notes and tips: In the code, cell A1 is used for the serial number. Any existing content in A1 will be overwritten by the first new sequence number, so if you have information you wish to keep, make sure to back up this cell before running the code. The default numeric prefix ("Company-00") can be adjusted in the VBA code to match your preferred serial format; change both the text and the numeric padding as desired. Be cautious when using the macro in shared or protected workbooks, as macro execution requires the proper permissions. If your printer is slow, avoid running the script with very large numbers of copies to prevent overwhelming the print queue.

If you encounter issues such as the print job not starting, numbers not incrementing correctly, or errors regarding cell references, double-check that macros are enabled and your worksheet is not protected. Make sure you have set the reference cell (A1 in this example) correctly before running, and consider saving your workbook before batch operations to avoid unintentional data loss. If further customization is required (such as using a different cell, number format, or worksheet), adjust the cell references and formatting lines in the VBA code as appropriate.

Best Office Productivity Tools

šŸ¤– Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

Excel Word Outlook Tabs PowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in