+ Reply to Thread
Results 1 to 4 of 4

Print Area:last row is variable depending on how many rows

Hybrid View

mafiaxts4life Print Area:last row is... 08-30-2011, 02:27 PM
barryleajo re: Print Area:last row is... 08-30-2011, 02:53 PM
hvg88 re: Print Area:last row is... 09-08-2011, 01:30 AM
barryleajo re: Print Area:last row is... 09-08-2011, 02:37 AM
  1. #1
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    re: Print Area:last row is variable depending on how many rows

    Hi mafiaxts4life
    Welcome to the forum.
    You may be able to adapt something like this to suit your needs:

    Sub pArea()
         
    Dim lastrow As Long
    Dim rngpaold As String, rngpanew As String
         
    'Collect current print range to restore later?
    rngpaold = ActiveSheet.PageSetup.PrintArea
         
    lastrow = Range("W" & Rows.Count).End(xlUp).Row
    rngpanew = "C3:W" & lastrow
    
    ActiveSheet.PageSetup.PrintArea = rngpanew
         
    End Sub

  2. #2
    Registered User
    Join Date
    09-06-2011
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    2

    re: Print Area:last row is variable depending on how many rows

    Quote Originally Posted by barryleajo View Post
    Hi mafiaxts4life
    Welcome to the forum.
    You may be able to adapt something like this to suit your needs:

    Sub pArea()
         
    Dim lastrow As Long
    Dim rngpaold As String, rngpanew As String
         
    'Collect current print range to restore later?
    rngpaold = ActiveSheet.PageSetup.PrintArea
         
    lastrow = Range("W" & Rows.Count).End(xlUp).Row
    rngpanew = "C3:W" & lastrow
    
    ActiveSheet.PageSetup.PrintArea = rngpanew
         
    End Sub
    Thanks for above....
    I have data, and if F10 value is 120, print row upto 120, how?
    plz. guide.......

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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