Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Specifying Print Quantity in a Cell.

Specifying Print Quantity in a Cell

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


1

Tom is trying to create some macro code that will control the quantity of copies to print, based on the value entered in a cell. He has created an input form for his shipping personnel to use that prints package content labels. He would like to be able to have them enter into cell B11 the number of labels that need to be printed, and then have that number printed.

This is relatively easy to do, depending on what you want to have printed. If you want to print just the contents of the active worksheet, then you can use code similar to the following:

iNumCopies = Range("B11").Value
If iNumCopies < 1 Then iNumCopies = 1
ActiveSheet.PrintOut Copies:=iNumCopies

If you don't want to print the entire worksheet, then you need to modify the PrintOut statement just a bit. For instance, the following example presumes that the "label" to be printed in in the range A1:A5:

Set MyRange = Range("A1:A5")
iNumCopies = Range("B11").Value
If iNumCopies < 1 Then iNumCopies = 1
MyRange.PrintOut Copies:=iNumCopies

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 (9487) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Specifying Print Quantity in a Cell.

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

Aligning Text on a Specific Character

Want to use tab stops to align text according to the position of a certain character? It's easy to do if that character ...

Discover More

Working with Elapsed Time

Work with times in a worksheet and you will eventually want to start working with elapsed times. Here's an explanation of ...

Discover More

Allowing Only Form Field Changes

Word allows you to create forms that other people can use to enter information. One of the last steps normally taken with ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Printing Limited Pages from a Range of Worksheets

Need to print just a few pages from a group of worksheets? The easiest way to handle the task may be through a macro, as ...

Discover More

Specifying a Paper Tray in a Macro

If you are using a macro to create your printed Excel output, you may need a way to specify that paper should come from a ...

Discover More

Printing Just the Visible Data

In a large worksheet, you may want to display and print just a portion of the available data. Displaying the desired ...

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 1 + 1?

2022-09-01 16:41:15

Joseph

Specifying Print Quantity in a Cell, is helpful but i want to know how to print a picture from this quantity??


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.