+ Reply to Thread
Results 1 to 2 of 2

Changing print area with respect to variable

  1. #1
    Registered User
    Join Date
    07-31-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    23

    Changing print area with respect to variable

    I am trying to set up a page break based on the last piece of information on the sheet.

    This piece of code works so far. But I am trying to get the upper range to be something like 3 rows higher than the last row.
    Please Login or Register  to view this content.
    I tried
    Please Login or Register  to view this content.
    but it comes up with a Syntax error.

  2. #2
    Registered User
    Join Date
    11-07-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Changing print area with respect to variable

    Try this

    Sub last_row()

    Dim lastrow As Long

    lastrow = Range("A65536").End(xlUp).Row
    ActiveSheet.PageSetup.PrintArea = "A1:F" & lastrow - 3

    End Sub

+ 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