Excel VBA - Data Validation List Automtic Macro

Gian624

Board Regular
Joined
Jul 23, 2009
Messages
92
Good Day,


I am helping acolleague of mine with some VBA code I am rather inexperienced with. She has aData Validation drop down list to select from. When a user makes a selectionfrom drop down, it hides and unhides specific rows based on what the colleaguewants the user to see. The code works as expected but the problem lies withblanks. If a user pushes the delete key when they click on the cell with the drop-downbox, the code goes into debug mode. I’ve tried a great any ways to end the subif that happens but all unsuccessfully. Please let me know if you have anythoughts. I can’t figure out how to get another if statement inside the Casestatement (that was my thought).


Thanks so much in advance,
Matt


Option Explicit


Private Sub Drop_Down(ByVal Target As Range)

ActiveSheet.Activate
If Not Application.Intersect(Range("D44"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value

Case Is = "": Rows("47:92").EntireRow.Hidden = False

Case Is = "Condition One": Rows("67:92").EntireRow.Hidden = True
Rows("47:67").EntireRow.Hidden = False

Case Is = "Condition Two": Rows("67:92").EntireRow.Hidden = True
Rows("47:67").EntireRow.Hidden = False

Case Is = "Condition Three": Rows("67:92").EntireRow.Hidden = True
Rows("47:67").EntireRow.Hidden = False

End Select

End If


End Sub

 
Last edited by a moderator:
Any one can help me to get a code for this case. If i select CI to value of 6 months term then it will automatically hide column 21-76 if 1 select 7 months then hide column 22-76 and so on. Hope to help me on this case
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top