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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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