+ Reply to Thread
Results 1 to 4 of 4

Find last relevant row in range and set as print area

  1. #1
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    245

    Find last relevant row in range and set as print area

    What I need is a macro that identifies and selects, as my print area, all rows in column B that contain a value plus all rows in colun A up to and including the next instance of the value "Y".

    In my attached sample workbook the last row containing data in column B is row 11. So I need to include all rows through row 11 in my print area. In addition, I need to include in my print area rows 12 and 13 since the next instance of the value "Y" in column A is two rows below the last row containing data in column B.

    I need a macro as this solution will be part of a larger app I'm working on. Any help is very much appreciated.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,448

    Re: Find last relevant row in range and set as print area

    Hi Grilleman,

    Here is code to go to the last cell in column B and then search for the next cell that has "Y" in it. See if this helps your question: Run the "LastRowInB sub to see answer.

    Please Login or Register  to view this content.
    find relevant last row sample for Grilleman.xlsm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,081

    Re: Find last relevant row in range and set as print area

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,723

    Re: Find last relevant row in range and set as print area

    And
    Please Login or Register  to view this content.

+ 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] Set print area for a dynamic range and launch print dialog
    By BONCH in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-17-2017, 11:37 PM
  2. 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
  3. Set print area of selected range then print preview if ok then print the document!
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2014, 07:10 AM
  4. [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
  5. VBA to set print range, open box asking for print qty, print, then redefine print area
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2012, 06:43 PM
  6. How to find Used Range and Print Area?
    By Joseph Geretz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-06-2006, 11:30 PM
  7. [SOLVED] Find print area
    By enginguven in forum Excel General
    Replies: 1
    Last Post: 01-11-2006, 10:00 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