ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide, Print, Unhide Rows (https://www.excelbanter.com/excel-programming/317634-hide-print-unhide-rows.html)

pfosz

Hide, Print, Unhide Rows
 

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 |
+-------------------------------------------------------------------+

--
pfosz
------------------------------------------------------------------------
pfosz's Profile: http://www.excelforum.com/member.php...o&userid=16792
View this thread: http://www.excelforum.com/showthread...hreadid=319893


Ron de Bruin

Hide, Print, Unhide Rows
 
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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"pfosz" wrote in message ...

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 |
+-------------------------------------------------------------------+

--
pfosz
------------------------------------------------------------------------
pfosz's Profile: http://www.excelforum.com/member.php...o&userid=16792
View this thread: http://www.excelforum.com/showthread...hreadid=319893





All times are GMT +1. The time now is 01:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com