Consulting

Results 1 to 3 of 3

Thread: Landscape and Portrait format at the same sheet

  1. #1
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    2
    Location

    Angry Landscape and Portrait format at the same sheet

    I d' like to know if anybody can help me. The question is simple: I have a Excel sheet and I want to print this sheet in landscape and portrait format depends on the number of the columns, like it, if the information use 10 columns I will print in landscape format, if less in portrait. Thanks a lot. I win to print in different pages but in a same not. I don't know if is possible do it in Excel.

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    You could put this in the ThisWorkbook code module.

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
        With Sh
            If .UsedRange.Columns.Count < 10 Then
                .PageSetup.Orientation = xlPortrait
            Else
                .PageSetup.Orientation = xlLandscape
            End If
        End With
    End Sub

  3. #3
    VBAX Newbie
    Joined
    Oct 2013
    Posts
    2
    Location
    Quote Originally Posted by mikerickson View Post
    You could put this in the ThisWorkbook code module.

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
        With Sh
            If .UsedRange.Columns.Count < 10 Then
                .PageSetup.Orientation = xlPortrait
            Else
                .PageSetup.Orientation = xlLandscape
            End If
        End With
    End Sub
    Dear mikerickson. I need to say thanks a lot about your help. I will try to use your code in my challenge. Regards.

Posting Permissions

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