alan myers
Board Regular
- Joined
- Oct 31, 2017
- Messages
- 119
- Office Version
- 365
- Platform
- Windows
how can i hide a row if say d5 = 0
then check d6 if 0 hide that row and so on
then check d6 if 0 hide that row and so on
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim cell As Range
' See if any cell just updated is in column E
Set rng = Intersect(Target, Columns("E:E"))
' Exit if no cells in range
If rng Is Nothing Then Exit Sub
' Loop through updated cells
For Each cell In rng
' Hide same row on Main sheet if 0
If cell = 0 Then
Sheets("Main").Rows(cell.Row).Hidden = True
' Otherwise unhide it
Else
Sheets("Main").Rows(cell.Row).Hidden = False
End If
Next cell
End Sub