[Solved] Need VBA/Macro code to hide rows with 0 values in columns


Sub HideRows()
Dim i As Long
Dim j As Long
Dim hide As Boolean
'loop through rows
For i = 9 To 54
    hide = True
    'loop in the row: B through AF column
    For j = 2 To 32
        'if we found value greater then zero, then we don't want to hide this row
        If Cells(i, j).Value > 0 Then
            hide = False
            Exit For
        End If
    Next j

    Rows(i).Hidden = hide
Next i

'loop thorugh second range
For i = 60 To 129
    hide = True
    'loop in the row: B through AF column
    For j = 2 To 32
        'if we found value greater then zero, then we don't want to hide this row
        If Cells(i, j).Value > 0 Then
            hide = False
            Exit For
        End If
    Next j

    Rows(i).Hidden = hide
Next i
End Sub

5

solved Need VBA/Macro code to hide rows with 0 values in columns