Hi-
I have a sheet that the user can print by clicking a commandbutton.
Range("A1:I160").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$160"
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
end sub
I set the rows to be printed to row 160. My question is if there is only data to fill one page (up to row 35) and the rest of the print range contains empty cells, how do you write a code that will stop the printer from printing the last blank 4 sheets. This sheet im printing at times may contain 10 rows of data or 150 rows of data at anytime.
I have a sheet that the user can print by clicking a commandbutton.
Range("A1:I160").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$160"
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
end sub
I set the rows to be printed to row 160. My question is if there is only data to fill one page (up to row 35) and the rest of the print range contains empty cells, how do you write a code that will stop the printer from printing the last blank 4 sheets. This sheet im printing at times may contain 10 rows of data or 150 rows of data at anytime.