View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Hiding "0" rows in printing.

I don't think this is what is wanted. The OP wants to hide empty rows for
printing, and then unhide them afterwards. AFAICS this just unhides any
hidden rows before printing.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"JE McGimpsey" wrote in message
...
No need for an explicit call - make it part of the BeforePrint macro:


Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
Application.EnableEvents = False
For Each wkSht In ActiveWindow.SelectedSheets
With wkSht
If .Name = "Sheet2" Then
.Select
.Cells.AutoFilter _
Field:=1, _
Criteria1:="<0"
.PrintOut Preview:=True
Selection.AutoFilter
Else
.PrintOut Preview:=True
End If
End With
Next wkSht
Application.EnableEvents = True
Cancel = True
End Sub