ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unhide/hide based on drop down list (https://www.excelbanter.com/excel-programming/442461-unhide-hide-based-drop-down-list.html)

SoilSaver

Unhide/hide based on drop down list
 
I have a cell with a drop down list (using data validation, list) and it has
3 values in it: High, Medium and Low. If the user chooses "Low", the
following 3 rows remain hidden. If the user chooses "Medium" or High", the
following 3 rows need to unhide so they can explain their reasoning. I am
new to macros, but found this macro that worked if I had only 2 choices on
the list:

Sub HideRows()
Dim Rng As Range
Set Rng = Sheets("Sheet1").Range("A3")
If Rng.Value = "High" Then
Rows("4:6").EntireRow.Hidden = False
Range("A9").Select
ElseIf Rng.Value = "Low" Then
Rows("4:6").EntireRow.Hidden = True
Range("A9").Select
End If
End Sub

What I want is a macro that will work with 3 choices (actually 4 - also hide
if blank), and is live, so that if the user chooses low at first, but then
comes back later and chooses high, the rows will unhide then.


All times are GMT +1. The time now is 10:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com