Hiding rows
Give this Change event code a try...
Private Sub Worksheet_Change(ByVal Target As Range)
Dim N As Long
If Target.Address = "$P$5" Then
N = Target.Value
If N 0 And N < 5 Then
Rows("6:9").Hidden = False
If N < 4 Then Rows((5 + N) & ":9").Hidden = True
End If
End If
End Sub
Rick (MVP - Excel)
"ordnance1" wrote in message
...
I need to be able to hide/unhide rows base upon a value.
If cell P5 has a value of 1, then hide rows 6,7,8 and 9
If cell P5 has a value of 2, then hide rows 7,8 and 9
If cell P5 has a value of 3, then hide rows 8 and 9
If cell P5 has a value of 4, then rows 6, 7, 8 and 9 would be visible
Would like to do this as a WorksheetChange event.
|