+ Reply to Thread
Results 1 to 20 of 20

Print number of copies based on a cell value

  1. #1
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Print number of copies based on a cell value

    Hi, I use this code to print envelopes, is there a way to modify it so that I can select how many to print from cell value in cell P15. Sheets("Env")

    Please Login or Register  to view this content.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Print number of copies based on a cell value

    This should work:
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Re: Print number of copies based on a cell value

    Hi, thanks for your reply. I pasted in the suggestion as below but I get a Run-time error 1004

    The number must be between 1 and 32767. Try again by entering a number within this range.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Print number of copies based on a cell value

    What value are you putting in P15

  5. #5
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Re: Print number of copies based on a cell value

    I was trying it with 1

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Print number of copies based on a cell value

    What is cell.P15 formatted as

  7. #7
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Re: Print number of copies based on a cell value

    I just tried it with 23, same error

  8. #8
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Re: Print number of copies based on a cell value

    The cell is formatted as General

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Print number of copies based on a cell value

    Upload a sample file as it works on my side when tested.

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Print number of copies based on a cell value

    Are you talking about P15 on the "Env" sheet? Or another sheet? I suspect it is a different one, but "Env" is active, so it is looking in P15 of that sheet. Add the sheet reference (to the one with the value in P15) to the code:

    Please Login or Register  to view this content.
    It could be I'm wrong of course... the original post does suggest it is in P15, but this was the first scenario that popped into my mind...
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Print number of copies based on a cell value

    @ Arkadi

    True...I just assumed that OP was printing active sheet....

  12. #12
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Print number of copies based on a cell value

    @sintek, I'm sure he is, the question is, is that the source of the P15 value. Once I re-read his original post I'm less confident my answer applied, but left it up just in case...

  13. #13
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Re: Print number of copies based on a cell value

    Yes Arkadi P15 is on the same sheet.

    I don't think the problem is with P15 , is it with the complete line in the code. From the , after Value
    Please Login or Register  to view this content.

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Print number of copies based on a cell value

    @ Arkadi

    I actually do think that you are right...Only problem I can foresee...

    EDITED:

    @ A440
    I don't think the problem is with P15 , is it with the complete line in the code. From the , after Value
    Code tested fine....Upload a sample workbook
    Last edited by sintek; 05-15-2017 at 10:22 AM.

  15. #15
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Re: Print number of copies based on a cell value

    Attached file
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Re: Print number of copies based on a cell value

    Stupid me, P15 is actually M16 . I am really sorry for this rookie error. It works now. I really do appreciate your time and effort and sorry to have wasted your time.

    This is the line I now have.
    Please Login or Register  to view this content.
    Last edited by A440; 05-15-2017 at 10:36 AM.

  17. #17
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Print number of copies based on a cell value

    The value for your prints is in M16 not P15
    Glad you noticed: Thanks for rep points

  18. #18
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Re: Print number of copies based on a cell value

    BTW, is there code to make the printer only print on one side? I have my printer set to print both sides by default.

  19. #19
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Print number of copies based on a cell value

    No, I don't think you can do this through vba, see this post from Andy Pope who suggest setting up a second copy of the same printer, and set that instance to print one-sided. P.S. thanks for the rep

  20. #20
    Forum Contributor
    Join Date
    11-03-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    246

    Re: Print number of copies based on a cell value

    Many thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro to print number of copies equal to the output of a formula in a specific cell
    By Spencerk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2014, 03:54 PM
  2. [SOLVED] VBA Code to Print a number of copies defined by number in cell
    By Rosco88 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-10-2014, 08:32 AM
  3. [SOLVED] Print X number of copies starting with cell value
    By Nu2Java in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2012, 10:05 PM
  4. Automating the Number of copies to print based on a range
    By lukeois in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-11-2008, 11:12 AM
  5. Print number of copies
    By Tarique in forum Excel General
    Replies: 2
    Last Post: 04-24-2006, 02:50 PM
  6. Print number of copies box
    By EMoe in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-08-2005, 11:09 AM
  7. number of copies in a print dialog box
    By LHaro in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2005, 01:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1