Thread
:
Help with a hide row macro (not using filter)
View Single Post
#
5
JE McGimpsey
Posts: n/a
One way:
If you really want to hide rows where cols A-H values are zero (not
blank):
Public Sub Hide_Print_Unhide()
Dim rCell As Range
Application.ScreenUpdating = False
With Sheets("Sheet1")
For Each rCell In .Range("A1:A300")
rCell.EntireRow.Hidden = Application.CountIf( _
rCell.Resize(1, 8), 0) = 8
Next rCell
.PrintOut Preview:=True
.Range("A1:A300").EntireRow.Hidden = False
End With
Application.ScreenUpdating = True
End Sub
In article . com,
wrote:
Can anyone help with this macro ?
I need it to hide any rows which have a value of 0 in cols A to H
I DON'T want to use filters.
Every time I run it, nothing is hidden
Thanks in advance
Sub Hide_Print_Unhide()
Dim rw As Long
Application.ScreenUpdating = False
With Sheets("Sheet1")
For rw = 1 To 300
If Application.WorksheetFunction.CountA( _
.Cells(rw, 1).Range("A1:H1")) = 0 Then _
.Rows(rw).Hidden = True
Next rw
.PrintOut
.Range("A1:A300").EntireRow.Hidden = False
End With
Application.ScreenUpdating = True
End Sub
Reply With Quote