+ Reply to Thread
Results 1 to 2 of 2

Print Visible rows and specific columns, force Landscape

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-07-2014
    Location
    Nottingham
    MS-Off Ver
    Office 2016
    Posts
    397

    Print Visible rows and specific columns, force Landscape

    I am trying to get a macro to enable colleagues to print a Briefing Sheet. Rows 12 - 206 hide/show depending the code

    Sub AutoFilter_Example1()
        Dim i           As Long
    
        Application.Calculation = xlCalculationManual
        Application.ScreenUpdating = False
    
        With ActiveSheet
            If .AutoFilterMode Then
                .AutoFilterMode = False
            End If
    
            With .Range("A12:D" & Cells(Rows.Count, "A").End(xlUp).Row)
                For i = 1 To .Columns.Count
                    .AutoFilter Field:=i, VisibleDropDown:=False
                Next i
                .AutoFilter Field:=1, Criteria1:="<>Hide"
            End With
        End With
    
        Application.Calculation = xlCalculationAutomatic
    
    End Sub
    I have used some very simple code
    Sub PrintSomeCells()
    Range("A1:E206").PrintOut
    End Sub
    and if I set my orientation to Landscape it prints fine, but if someone else opens the document their local settings override the Landscape/Portrait options.

    How am I able to print Visible Rows in A1:E206, in Landscape
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,068

    Re: Print Visible rows and specific columns, force Landscape

    Maybe

    Sub PrintSomeCells()
    Dim currOrientation As Long
    With ActiveSheet
        currOrientation = .PageSetup.Orientation
        .PageSetup.Orientation = xlLandscape
        .Range("A1:E206").PrintOut
        .PageSetup.Orientation = currOrientation
    End With
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 9
    Last Post: 04-26-2017, 03:11 AM
  2. Replies: 4
    Last Post: 04-25-2017, 05:21 PM
  3. vba copy specific columns with visible rows to another sheet
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-11-2016, 02:47 PM
  4. [SOLVED] VB to force Landscape & Black and White Printing
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 5
    Last Post: 09-21-2013, 06:59 PM
  5. Print specific rows/columns IF a cell meets criteria
    By tiannaleft in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-16-2012, 08:51 AM
  6. Print only visible rows and a print to or save as pdf Macro
    By rlebeausw in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2011, 10:08 PM
  7. Resize Visible Rows based only on Visible Columns text
    By Zimbo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2009, 10:55 AM

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