Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Action from list selection
All:
I have a number of options in a drop down list and based on the selection (2, 3, 4 etc) need to unhide rows. So if user selects 4, need to unhide 4 rows, if they select 0, no rows should show. What's the best way to do this? Thank you. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Action from list selection
I assume you have a number of rows hidden? after all in a sheet you can't
show no rows can you? something like Private Sub ComboBox1_Change() Range("A10:A20").EntireRow.Hidden = True Range("A10").Resize(ComboBox1.Value).EntireRow.Hid den = False End Sub this uses the activex combobox, so the code should be on the sheet's code page - to get there, right click the sheet tab & select View Code "Maze" wrote: All: I have a number of options in a drop down list and based on the selection (2, 3, 4 etc) need to unhide rows. So if user selects 4, need to unhide 4 rows, if they select 0, no rows should show. What's the best way to do this? Thank you. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Action from list selection
Patrick - thanks for replying. Maybe I wasn't clear enough with my question
but I was able to figure some code out that would work, the only problem is it only works one directional. (Example: if user selects 4, then 5, it works. If they select 2 it won't go back). Any thoughts? See code below. Sub DropDown44_Change() 'IBDA selection If range("v1").Value = "2" Then Rows("16:19").Hidden = False ElseIf range("v1").Value = "3" Then Rows("16:23").Hidden = False ElseIf range("v1").Value = "4" Then Rows("16:27").Hidden = False ElseIf range("v1").Value = "5" Then Rows("16:31").Hidden = False ElseIf range("v1").Value = "6" Then Rows("16:35").Hidden = False Else Rows("16:60").Hidden = True End If End Sub "Patrick Molloy" wrote: I assume you have a number of rows hidden? after all in a sheet you can't show no rows can you? something like Private Sub ComboBox1_Change() Range("A10:A20").EntireRow.Hidden = True Range("A10").Resize(ComboBox1.Value).EntireRow.Hid den = False End Sub this uses the activex combobox, so the code should be on the sheet's code page - to get there, right click the sheet tab & select View Code "Maze" wrote: All: I have a number of options in a drop down list and based on the selection (2, 3, 4 etc) need to unhide rows. So if user selects 4, need to unhide 4 rows, if they select 0, no rows should show. What's the best way to do this? Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Take Action on Cells within Selection | Excel Programming | |||
action upon selection | Excel Programming | |||
Action on sheet Selection | Excel Programming | |||
Action on sheet Selection | Excel Programming | |||
onClick action from cell selection | Excel Programming |