Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding rows
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Color alternate rows when after hiding selected rows | Excel Worksheet Functions | |||
Hiding Specific Rows Based on Values in Other Rows | Excel Worksheet Functions | |||
Hiding a button when hiding rows | Excel Discussion (Misc queries) | |||
hiding Rows and buttons/comboxes, over the rows | Excel Programming | |||
Hiding Rows if the linked rows are blank | Excel Discussion (Misc queries) |