Hiding and Unhiding Columns based on multiple drop down lists

JoRyBar

New Member
Joined
Aug 19, 2018
Messages
17
Hi Gurus,

I have a stomper. I am trying to hide/unhide columns based on three different drop down lists. The below formula works to hide/unhide when individual drop down lists are selected, however does not work together to "filter down" and show only the columns that apply when all three drop downs are selected.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Fnd As Range
If Target.Address(0, 0) = "C3" Then
If Target.Value = "" Then
Range("F:JY").EntireColumn.Hidden = False
Else
For Each Cl In Range("F9:JY9")
Cl.EntireColumn.Hidden = Cl.Value <> Target.Value
Next Cl
End If
End If
If Target.Address(0, 0) = "C5" Then
If Target.Value = "" Then
Range("F:JY").EntireColumn.Hidden = False
Else
For Each Cl In Range("F10:JY10")
Cl.EntireColumn.Hidden = Cl.Value <> Target.Value
Next Cl
End If
End If
If Target.Address(0, 0) = "C7" Then
If Target.Value = "" Then
Range("F:JY").EntireColumn.Hidden = False
Else
For Each Cl In Range("F11:JY11")
Cl.EntireColumn.Hidden = Cl.Value <> Target.Value
Next Cl
End If
End If

For example, if in the drop down I have 1) Vendors, 2) Countries, and 3) Type, I want to be able to hide all the columns except what are selected in drop downs 1-3. Alternatively, I would like to pick only 3) Type and not have to selected 1) Vendors and 2) Countries for this to work.

Hope this makes sense. Any help is greatly appreciated!

Thanks!
Novice
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,136,864
Messages
5,678,213
Members
419,751
Latest member
richkings

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
Top