+ Reply to Thread
Results 1 to 4 of 4

Print a specific number of pages based on cell value

  1. #1
    Registered User
    Join Date
    08-20-2010
    Location
    uk
    MS-Off Ver
    Office Pro Plus 2016
    Posts
    90

    Print a specific number of pages based on cell value

    Hi All,

    Is there a way to print a set number of pages from a valve in a cell .. The cell value does change ..

    I.E
    Cell A1 value is set to 4 - I want to print 4 pages
    or
    Cell A1 value is set to 2 - I want to print 2 pages

    And so ..

    Thanks

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Print a specific number of pages based on cell value

    I'm sure it's possible. You will have to write a macro for this.
    I assume that your page breaks are set within page setup.
    You will have to a page break count and depending on that cell value you mention, print that section if the page break count corresponds to what you have indicated.
    You'll have to play around with that in a macro, you can use preview so you don't waste too much paper.
    I haven't tried it but my guess this should work one way or another.
    Hope I've bee bale to give you a hint that will solve your issue
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Print a specific number of pages based on cell value

    I agree with the above, but do you want for example pages 1-4, or 4 copies of page 1?

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Print a specific number of pages based on cell value

    Hi Janger,

    You can specify which pages in VBA similar to the way you do it manually in Excel. For Example to print pages 2 and 3:
    Please Login or Register  to view this content.
    See the attached file which contains a more robust example using the following code:
    Please Login or Register  to view this content.
    To prevent typos from ruining days and weeks of work 'Option Explicit' is NEEDED at the top of each code module. This prevents errors caused by missspellings and FORCES every variable to be DECLARED (e.g. Dim i as Integer). https://www.excel-easy.com/vba/examp...-explicit.html

    To enable Macros and to Run Macros see the following:
    http://office.microsoft.com/en-us/ex...010031071.aspx
    http://office.microsoft.com/en-us/ex...010014113.aspx
    If help is still needed do a google search for 'youtube excel enable macro' and/or 'youtube excel run macro'.

    To access Visual Basic (VBA) see:
    http://www.ablebits.com/office-addin...a-macro-excel/
    a. Click on any cell in the Excel Spreadsheet (may not be needed).
    b. ALT-F11 to get to VBA.
    c. CTRL-R to get project explorer (if it isn't already showing).
    d. Double Click on a 'Module Name' in 'Project Explorer' to see code for that module.

    Lewis

+ 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. VBA print x number of copies based on number specified in a cell
    By ngyrpd in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-15-2020, 09:15 PM
  2. [SOLVED] excel vba print specific worksheet and pages based on cell value
    By ridwan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2019, 01:38 PM
  3. Replies: 0
    Last Post: 09-02-2014, 12:59 PM
  4. [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
  5. Print worksheet based on cell value to specific printer
    By swiftrain in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2013, 09:57 AM
  6. Print specific pdf page based on number in cell
    By cbdu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-14-2013, 05:18 PM
  7. Print specific pages based on specific cells
    By cane corso in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2008, 05:23 PM

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