+ Reply to Thread
Results 1 to 9 of 9

Dynamic Print Range for PDF Export

  1. #1
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Dynamic Print Range for PDF Export

    Hi,

    I've got a workbook that runs through a series of filters, generates new sheets, and prints their contents to PDF files.

    I'm currently hard-coding a print range, "A1:J40", for the exported PDF files.
    However, what I would really like to be able to do is to have the range dynamically change based on the last row of available data.

    The reason for setting it to end at J40 is because that's the largest dataset I have encountered thus far, but that may likely change.

    I've attached a sample of my code below that generates the PDfs (with range selection in bold) as well as the actual workbook that I'm using to generate all of these PDFs.

    I would genuinely appreciate any help offered.
    Thanks in advance!


    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Dynamic Print Range for PDF Export

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Dynamic Print Range for PDF Export

    AWESOME!
    Thank you so much for that solution patel45!

  4. #4
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Dynamic Print Range for PDF Export

    I had trouble with your attachment -try something like this to redefine your print area (I edited your With statement). I wasn't able to test your attachment, but this should do it.

    Please Login or Register  to view this content.
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  5. #5
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Dynamic Print Range for PDF Export

    Crap, I need to refresh my screen more sorry, already answered.

  6. #6
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Dynamic Print Range for PDF Export

    General, no worries
    I'm always interested in alternative solutions, so thank you for posting that approach.

  7. #7
    Registered User
    Join Date
    06-03-2019
    Location
    Hmaiton
    MS-Off Ver
    2010
    Posts
    3

    Re: Dynamic Print Range for PDF Export

    Hello Sir I need you help to sort dynamic pdf range with email macro

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,347

    Re: Dynamic Print Range for PDF Export

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original. Please start a new thread - See Forum rule #4

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Registered User
    Join Date
    06-03-2019
    Location
    Hmaiton
    MS-Off Ver
    2010
    Posts
    3

    Re: Dynamic Print Range for PDF Export

    you are awesome..

+ 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. how to print using combobox and make dynamic range of a print area
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-04-2014, 07:26 AM
  2. how to macros print / export to word doc with dynamic data count
    By mastakillah in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2013, 08:53 PM
  3. [SOLVED] Need ‘Set Print Area’ Code for Dynamic Print Range based on Conditions
    By dosbirn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2013, 12:13 PM
  4. [SOLVED] Automatically Print Once Dynamic Print Range is Identified
    By ccowman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-27-2013, 10:34 AM
  5. Print Titles with Dynamic Print Range
    By Daeghen in forum Excel General
    Replies: 0
    Last Post: 08-01-2011, 12:11 PM

Tags for this Thread

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