Hide rows based on dropdown

Dcata

New Member
Joined
Apr 10, 2018
Messages
7
Hi Guys!

I have a dropdown with a list of 5 different options.

Is there a way that I can hide all rows between 2-70 that don't have the dropdown value I have selected in column a?

e.g. for each row between 2-70, if column A <> A1 (this is where my dropdown value is) then row = hidden

Rows 2-70 completely change every week.

Cheers!
 

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.
This needs to go in the sheet module
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   Dim r As Long
   If Target.CountLarge > 1 Then Exit Sub
   If Target.Address(0, 0) = "A1" Then
      For r = 2 To 70
         Rows(r).Hidden = Range("A" & r).Value <> Target.Value
      Next r
   End If
End Sub
 
Upvote 0
Perfect!

Thanks for helping out Fluff. Is there a way to modify that to say if dropdown = " " then display everything?
 
Upvote 0
How about
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   Dim r As Long
   If Target.CountLarge > 1 Then Exit Sub
   If Target.Address(0, 0) = "A1" Then
      If Target.Value = " " Then
         Rows("2:70").Hidden = False
      Else
         For r = 2 To 70
            Rows(r).Hidden = Range("A" & r).Value <> Target.Value
         Next r
      End If
   End If
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,040
Members
448,543
Latest member
MartinLarkin

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