ub CreateReport()
Dim ws As Worksheet
Dim intRowMax As Integer
'Cycle through all sheets that need printing
For Each ws In Application.Worksheets
If ws.Range("P1").Value = "Print" Then
intRowMax = Range("A" & Rows.Count).End(xlUp).Row
ws.PageSetup.PrintArea = "A1:I" & intRowMax
If Sheets("Property").Range("P2").Value = "Portrait" Then
ws.PageSetup.Orientation = xlPortrait
Else
ws.PageSetup.Orientation = xlLandscape
End If
ws.PageSetup.LeftFooter = "&Z" & "\" & "&F"
ws.PageSetup.RightFooter = "&D &T"
ws.PageSetup.RightFooter = ""
ws.PrintOut
End If
Next
Sheets("Property").Select
Set ws = Nothing
End Sub