+ Reply to Thread
Results 1 to 6 of 6

Page Setup / Print Formatting

  1. #1
    Registered User
    Join Date
    01-07-2010
    Location
    Oregon
    MS-Off Ver
    Excel 2007, 2010 - maintain backwards compatibility to 2003 when possible
    Posts
    17

    Exclamation Page Setup / Print Formatting

    Ok, been mulling over this for a while and I've gotten close, but here's my initial code:

    Some pre-info, the macro's before this combine data from about 15 worksheets down to 2 worksheets and format them just the way I want them to look, except that in the process the print area gets totally hosed up. The worksheets are a set width, but can vary in height from a few dozen rows to hundreds.

    Here's the code so far:

    Please Login or Register  to view this content.
    Here's the problem... I don't want the print area to be set to 200 rows, I want it to be set to the last row in the spreadsheet. Now I know how to find the last row containing data, and select the next row in the spreadsheet (the first empty row) using this code:

    Please Login or Register  to view this content.
    So, any idea how to dynamically set the print area to the last populated row, instead of a defined 200 rows?

    Thanks!
    Last edited by vaximily; 05-07-2010 at 01:46 PM.

  2. #2
    Registered User
    Join Date
    01-07-2010
    Location
    Oregon
    MS-Off Ver
    Excel 2007, 2010 - maintain backwards compatibility to 2003 when possible
    Posts
    17

    Re: Page Setup / Print Formatting

    Also to add to my thought process, if I could somehow select the last row and 500 rows after it, delete those rows, save the file, and clear the print area, it would automatically set the print area to the last row in the worksheet.

    Not sure which method will work better / faster / easier, so I'll wait for you guys to respond =)

  3. #3
    Registered User
    Join Date
    01-07-2010
    Location
    Oregon
    MS-Off Ver
    Excel 2007, 2010 - maintain backwards compatibility to 2003 when possible
    Posts
    17

    Re: Page Setup / Print Formatting

    Any takers? =)

  4. #4
    Registered User
    Join Date
    01-07-2010
    Location
    Oregon
    MS-Off Ver
    Excel 2007, 2010 - maintain backwards compatibility to 2003 when possible
    Posts
    17

    Re: Page Setup / Print Formatting

    3 days and still no response =(. Anybody have any ideas?

  5. #5
    Registered User
    Join Date
    12-02-2009
    Location
    New York State
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: Page Setup / Print Formatting

    "Here's the problem... I don't want the print area to be set to 200 rows, I want it to be set to the last row in the spreadsheet. Now I know how to find the last row containing data, and select the next row in the spreadsheet (the first empty row) using this code:"

    Ok. I'm an absolute newb here, but I used to do something similar in Lotus123 macros, maybe before you were born. I dunno.

    Go to the top cell of the range you want to select.
    Start macro recording.
    SHIFT/END/DOWN ARROW
    <click the handy Set Print Area icon on the toolbar>
    end recording

    What I don't know is whether you can pasted recorded macros into the middle of a your code script or whatever you call it. If you can paste this is, so to speak, seems like it might work. Then again, if it is recordable, musn't there be code that can do the same thing? But I guess that was what you were asking for in the first place.


    Just trying to help.

  6. #6
    Registered User
    Join Date
    01-07-2010
    Location
    Oregon
    MS-Off Ver
    Excel 2007, 2010 - maintain backwards compatibility to 2003 when possible
    Posts
    17

    Re: Page Setup / Print Formatting

    Quote Originally Posted by excelname View Post
    "Here's the problem... I don't want the print area to be set to 200 rows, I want it to be set to the last row in the spreadsheet. Now I know how to find the last row containing data, and select the next row in the spreadsheet (the first empty row) using this code:"

    Ok. I'm an absolute newb here, but I used to do something similar in Lotus123 macros, maybe before you were born. I dunno.

    Go to the top cell of the range you want to select.
    Start macro recording.
    SHIFT/END/DOWN ARROW
    <click the handy Set Print Area icon on the toolbar>
    end recording

    What I don't know is whether you can pasted recorded macros into the middle of a your code script or whatever you call it. If you can paste this is, so to speak, seems like it might work. Then again, if it is recordable, musn't there be code that can do the same thing? But I guess that was what you were asking for in the first place.


    Just trying to help.
    Apparently I never got notified of a response on this. Thanks so much for the suggestion, I put this on hold and just set the number of rows manually in the macro before I run it now, but I will definitely give this a shot in the morning and report back on my findings.

    Thanks! =)

+ 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