I am trying to get the following code to hide rows in Excel where the value in column C is greater than zero, but less than 1. The code " If c.Value <1 Then Rows(c.Row).Hidden = True" does not work
See Sample worksheet below. I need to hide the rows where the values are below 1 for eg 0.36
Nissan UNITS SOLD 1 TON/NAV 14 29.59%
Nissan UNITS RET STRADA 9 19.29%
Nissan UNITS SOLD 1400 LDV 9 18.73%
Nissan UNITS RT PUNTO/PANDA 4 8.61%
Nissan U/S FIAT PAL/PUNTO 4 8.24%
Nissan UNIT SLD PATROL/PATH 3 6.18%
Nissan UNIT SLD TERR/XTRAIL 2 3.75%
Nissan U/SLD NISS MICRA 1 2.06%
Nissan UNITS SOLD ALM/TIIDA 1 2.06%
Nissan UNITS SLD NIS CSTAR 0.36 0.75%
Nissan RET UNITS SOLD STILO 0.09 0.19%
Private Sub Worksheet_Activate()
Dim rng As Range, c As Range
Set rng = Columns(3).SpecialCells(xlCellTypeFormulas, 1)
Application.ScreenUpdating = False
For Each c In rng
If c.Value <1 Then
Rows(c.Row).Hidden = True
Else
Rows(c.Row).Hidden = False
End If
Next c
Application.ScreenUpdating = True
End Sub
Your assistwance will be most appreciated
Howard
See Sample worksheet below. I need to hide the rows where the values are below 1 for eg 0.36
Nissan UNITS SOLD 1 TON/NAV 14 29.59%
Nissan UNITS RET STRADA 9 19.29%
Nissan UNITS SOLD 1400 LDV 9 18.73%
Nissan UNITS RT PUNTO/PANDA 4 8.61%
Nissan U/S FIAT PAL/PUNTO 4 8.24%
Nissan UNIT SLD PATROL/PATH 3 6.18%
Nissan UNIT SLD TERR/XTRAIL 2 3.75%
Nissan U/SLD NISS MICRA 1 2.06%
Nissan UNITS SOLD ALM/TIIDA 1 2.06%
Nissan UNITS SLD NIS CSTAR 0.36 0.75%
Nissan RET UNITS SOLD STILO 0.09 0.19%
Private Sub Worksheet_Activate()
Dim rng As Range, c As Range
Set rng = Columns(3).SpecialCells(xlCellTypeFormulas, 1)
Application.ScreenUpdating = False
For Each c In rng
If c.Value <1 Then
Rows(c.Row).Hidden = True
Else
Rows(c.Row).Hidden = False
End If
Next c
Application.ScreenUpdating = True
End Sub
Your assistwance will be most appreciated
Howard