Hide rows based on data validation dropdown list.

holz_001

New Member
Joined
Oct 29, 2019
Messages
5
Hi,

I am looking to hide/unhide rows based on a drop down validation.

The below codes works for one drop down however I have a further 2 drop downs that need to hide different rows.

any help will be greatly appreciated.

Private Sub Worksheet_Change(ByVal Target As Range)
'Updated by Extendoffice 20180822
If Target.Column = 9 And Target.Row = 5 Then
If Target.Value = "No" Then
Application.Rows("52:62").Select
Application.Selection.EntireRow.Hidden = True
ElseIf Target.Value = "Yes" Then
Application.Rows("52:62").Select
Application.Selection.EntireRow.Hidden = False
End If
End If
End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
How about
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Target.Address(0, 0) = "I5" Then
        Rows("52:62").Hidden = Target.Value = "No"
    ElseIf Target.Address(0, 0) = "[COLOR=#ff0000]J5[/COLOR]" Then
        Rows("[COLOR=#ff0000]65:70[/COLOR]").Hidden = Target.Value = "No"
    End If
End Sub
Change address & rows in red to suit
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

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