Consulting

Results 1 to 4 of 4

Thread: Sleeper: Landscape if 2 pages wide?

  1. #1
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location

    Sleeper: Landscape if 2 pages wide?

    I haven't been here in a while because I haven't written code in a while. Well now I am back to it but a little rusty. So please bare with me. I need to get my feet wet. Is there a way to say if my spreadsheet is wider than one page then switch to landscape and if not stay portrait.

    Thank you,
    Daniel

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I may be wrong Daniel but if your looking for some kind of auto-detect then I would guess the answer is no.....maybe brighter folks have a different opinion.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    This will switch the print to landscape.

    Sub chgprintout() 
        With ActiveSheet.PageSetup 
            .Orientation = xlLandscape 
        End With 
    End Sub
    Not sure on how to determine if its wider than one page.

  4. #4
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Excel's Range object has a CurrentRegion property, which returns another
    Range object representing contiguous data. This is a helpful way to find
    where a sheet extends to.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •