View Single Post
 
Old 06-09-2015, 11:20 PM
Deane Deane is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jun 2015
Posts: 8
Deane is on a distinguished road
Default Hide rows in multiple columns based on zero values

Hi there I have used the code belowto hide rows based on zero values but it only considers the 3rd column. How do i get the code to consider a range of columns and only hide the row if there are zeros values in the entire range not just column 3?

Code I used:

Sub HURows()
BeginRow = 1
EndRow = 200
ChkCol = 3

For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = 0 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
End If
Next RowCnt
End Sub
Reply With Quote