PDA

View Full Version : [SOLVED:] Printing only non-blank rows



oam
10-06-2014, 05:34 PM
I am having trouble finding a code that will print only the rows containing data and not ther entire print range. I am using the code shown below.

Any help will be appreciated.





Sub Macro6
Worksheets("Parts Batches").Activate
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets("Parts Batches").Visible = xlSheetVisible
Sheets("Parts Batches").Unprotect
Application.Run "PartsBatchStatus.xlsm!Sheet4.Print_Used_Cells_C"
Sheets("Parts Batches").Visible = xlSheetHidden
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

Sub Print_Used_Cells_C()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If Range("B1") <> "SHG" Or Range("B1") <> "SNY" Then 'Exit Sub
With ActiveSheet
.Range("C1:K37").AutoFilter Field:=1, Criteria1:="<>"
.PageSetup.PrintArea = Range("C1:K37").Address
.PrintPreview
'.PrintOut Copies:=1, Collate:=True
.DisplayAutomaticPageBreaks = False
.AutoFilterMode = False
End With

Application.DisplayAlerts = True
Application.ScreenUpdating = True
End If
End Sub