Incrementing Copy Numbers for Printouts

Written by Allen Wyatt (last updated November 21, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


1

Henry would like a cell to contain a number that increments every time a copy of the worksheet is printed. Thus, if the cell contains the number 9 and he prints 13 copies of the worksheet, each copy would contain, in that cell, the numbers 9, 10, 11, and on through 21.

This, as you might guess, is best done with a macro. All that needs to be done is to print the worksheet however many times is desired, incrementing the value of the cell after each print. In this case, I'm going to assume that the cell to be incremented is B7. The following macro will handle the process:

Sub PrintNumberedCopies()
    Dim iCopies As Integer
    Dim J As Integer
    Dim r As Range

    ' Specify the cell to modify
    Set r = Range("B7")

    ' Get the number of copies.
    iCopies = Val(InputBox("Number of copies to print:"))

    If iCopies > 0 Then
        ' Loop iCopies times, printing once per loop
        For J = 1 to iCopies
            ActiveSheet.PrintOut
            r.Value = r.Value + 1
        Next J
    End If
End Sub

Note that the macro asks the user how many copies to print, and then it goes about printing each one, individually. After each printout, it increments the value stored in cell B7. If the user enters something that does not translate to a number of copies, then nothing is printed.

Remember that if you want the value number in B7 to always be up to date, you'll need to save the workbook sometime after your last printing. In addition, if you print using some method other than this macro, then the value in B7 will not reflect the number of actual copies printed.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12135) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Formatting All Headings At Once

If you need to apply a common formatting change to all the headings in your document, a quick way to do it is to use the ...

Discover More

Sharing Your Workbook

Need to allow others to contribute to your Excel workbook? It's easy to do if you just share it. This tip provides an ...

Discover More

Speeding Up Mail Merges

The Mail Merge tool in Word is a great way to create new, customized documents. If you are doing a lot of merging, you ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Specifying an Order for Page Printing

If a printout of your worksheet requires multiple pages, you may want to specify the order in which Excel prints those ...

Discover More

Controlling the Printer in a Macro

Need to access the advanced capabilities of a printer from within an Excel macro? You may be out of luck, unless you ...

Discover More

Printing a Portion of a Worksheet

Need to print a portion of a worksheet, but don't want to waste paper by printing the whole thing? It's easy to print ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 2 + 2?

2023-08-08 15:06:55

Marc

Thanks, Allan. Works great.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.