Hello,

I put together a macro to set the print area which will change since it is running off of a pivot. The macro works fine on some of my tabs but one in particular it is printing the range including the blank rows with formulas in it. Like I said the same code works on other tabs with blank rows that have formulas in it. It is breaking on this one tab specifically. You can even see it selects the appropriate range (See - - - - marks once you close print preview). My code is below. The file is too large to upload. Any help would be awesome!

Sub Print_Area_Click_ByMallInPlace()
    Dim LastRow As Long
    With ActiveSheet
        LastRow = .Cells(.rows.Count, 1).End(xlUp).Row
        .PageSetup.PrintArea = Range(.Cells(1, 1), .Cells(LastRow, 45)).Address
        .PageSetup.FitToPagesWide = 1
        .PageSetup.FitToPagesTall = 5
        .PageSetup.LeftHeader = ""
        .PageSetup.CenterHeader = ""
        .PageSetup.RightHeader = ""
        .PageSetup.LeftFooter = ""
        .PageSetup.CenterFooter = ""
        .PageSetup.RightFooter = ""
        .PageSetup.PrintQuality = 600
        .PageSetup.CenterHorizontally = False
        .PageSetup.CenterVertically = False
        .PageSetup.Orientation = xlPortrait
        .PageSetup.Draft = False
        .PageSetup.PaperSize = xlPaperLetter
        .PageSetup.FirstPageNumber = xlAutomatic
        .PageSetup.Order = xlDownThenOver
        .PageSetup.BlackAndWhite = False
        .PageSetup.PrintTitleRows = "$1:$19"
        .PageSetup.PrintTitleColumns = ""

        Application.EnableEvents = False
        ActiveWindow.ActiveSheet.PrintPreview
        Application.EnableEvents = True
    End With
End Sub