Hide, Print, Unhide Rows

P

pfosz

I am looking for a macro to hide rows with zero values (all cells in the
row must equal zero), it should skip blank rows, print, then unhide the
rows.

The attached file is a sample and the data range I am focusing on is =
D10:p154.

Thanks!


+-------------------------------------------------------------------+
|Filename: Book3.zip |
|Download: http://www.excelforum.com/attachment.php?postid=2802 |
+-------------------------------------------------------------------+
 
R

Ron de Bruin

Hi

Try this example for the activesheet

Sub Example()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 10
EndRow = 154
For Lrow = EndRow To StartRow Step -1
If Application.CountIf(Range(.Cells(Lrow, "D"), _
.Cells(Lrow, "P")), "0") = 13 Then .Rows(Lrow).Hidden = True
Next
.PrintOut
.Range("A1:A154").EntireRow.Hidden = False
End With

With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top