+ Reply to Thread
Results 1 to 6 of 6

Printing only final row of data

Hybrid View

  1. #1
    Registered User
    Join Date
    08-20-2015
    Location
    Springfield, IL
    MS-Off Ver
    10
    Posts
    11

    Printing only final row of data

    Hi! I have a spreadsheet I am working on in which multiple columns have variable amounts of data input. I only want to print down to the last row filled in.

    All data is entered in column F. I am using the following macro (found here):

    Sub PrintA()
    'prints rows of data, will not print rows if column F is blank
    Application.ScreenUpdating = False
    Range("F:F").EntireRow.Hidden = False
    Range("F:F").SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    Range("F:F").EntireRow.Hidden = False
    Application.ScreenUpdating = True
    End Sub
    The problem is, I have other fields off to the side that extend down to row-18. If only a few items are entered into column F (that is, if the data doesn't fill through row-18), this macro cuts off all of that extra information.

    I want to always print through row-18, and after that have it cut off after the last item entered in column F.

    Thanks!
    Last edited by Cillendor; 10-08-2015 at 06:55 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,183

    Re: Printing only final row of data

    Untested, but maybe try:

    Sub PrintA()
    'prints rows of data, will not print rows if column F is blank
    Application.ScreenUpdating = False
    Range("F:F").EntireRow.Hidden = False
    Range("F19:F" & Rows.Count).SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    Range("F:F").EntireRow.Hidden = False
    Application.ScreenUpdating = True
    End Sub
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    08-20-2015
    Location
    Springfield, IL
    MS-Off Ver
    10
    Posts
    11

    Re: Printing only final row of data

    It works! Thank you!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,183

    Re: Printing only final row of data

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  5. #5
    Registered User
    Join Date
    08-20-2015
    Location
    Springfield, IL
    MS-Off Ver
    10
    Posts
    11

    Re: Printing only final row of data

    Fixed! Thanks again.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,183

    Re: Printing only final row of data

    You're welcome. Thanks for the rep.

+ 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] Transfer data in two sheets to final sheet
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2015, 11:15 AM
  2. [SOLVED] Need Final Value to be Based on Data in 2 Other Cells
    By aliciaward1001 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-23-2015, 12:12 PM
  3. Creating a Final Estimate Form and a Final Materials List based on Worksheet Results
    By Crunched For Time in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 12-20-2013, 09:58 PM
  4. Need help in using a formula using a data range to determine a final value
    By Lalli187 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-23-2013, 07:17 AM
  5. [SOLVED] UserForm Enters Final Data Into First Row
    By LoneWolf3574 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-01-2012, 07:46 PM
  6. replacing lowest test grade with final if final is higher formula help
    By colbyclay in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-16-2012, 02:48 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