Hi,
I have to write a macro to hide all rows in range B:J where values in all cells in this range are zero, but if the cell is blank ( I have some blank cells between sections) I don't want it to be hidden.
All help will be greatly appreciated.
Here is the code I have now, but it's hiding blank rows as well as zero value rows.
Sub Macro2()
'
' Macro2 Macro
Dim X As Integer
For X = 14 To Range("B" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
If Range("B" & X).Value = 0 And Range("C" & X).Value = 0 And Range("D" & X).Value = 0 And Range("E" & X).Value = 0 And _
Range("F" & X).Value = 0 And Range("G" & X).Value = 0 And Range("I" & X).Value = 0 And _
Range("J" & X).Value = 0 Then
Range("B" & X).EntireRow.Hidden = True
End If
Next X
End Sub
Thanks,
Nermina
I have to write a macro to hide all rows in range B:J where values in all cells in this range are zero, but if the cell is blank ( I have some blank cells between sections) I don't want it to be hidden.
All help will be greatly appreciated.
Here is the code I have now, but it's hiding blank rows as well as zero value rows.
Sub Macro2()
'
' Macro2 Macro
Dim X As Integer
For X = 14 To Range("B" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
If Range("B" & X).Value = 0 And Range("C" & X).Value = 0 And Range("D" & X).Value = 0 And Range("E" & X).Value = 0 And _
Range("F" & X).Value = 0 And Range("G" & X).Value = 0 And Range("I" & X).Value = 0 And _
Range("J" & X).Value = 0 Then
Range("B" & X).EntireRow.Hidden = True
End If
Next X
End Sub
Thanks,
Nermina