martinlemonkiss
New Member
- Joined
- Jul 24, 2007
- Messages
- 3
Hi
I'm trying to write a macro which will look up a row and if in column b,c,and d all have zeros then it hides the row...the closest i can find after searching the web is below which looks up just the one column but i can't work out how to make it look up three columns other than putting a if and statement in a column and then looking up that column but i'd rather the macro did all the work
Sub HideRows()
BeginRow = 1
EndRow = 1000
ChkCol = 4
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value < 1 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
End If
Next RowCnt
End Sub
I'm trying to write a macro which will look up a row and if in column b,c,and d all have zeros then it hides the row...the closest i can find after searching the web is below which looks up just the one column but i can't work out how to make it look up three columns other than putting a if and statement in a column and then looking up that column but i'd rather the macro did all the work
Sub HideRows()
BeginRow = 1
EndRow = 1000
ChkCol = 4
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value < 1 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
End If
Next RowCnt
End Sub