VBA: Filter range by dropdown list selection + another criteria

Martin_H

Board Regular
Joined
Aug 26, 2020
Messages
190
Office Version
  1. 365
Platform
  1. Windows
Morning all,

I hope you all had a great weekend.

This newly created thread follows this one.

I wanted to filter the range D4:D590 by value selected from dropdown list located at the cell DK1, which has been solved by Fluff and fadee2. I used this code for it:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.CountLarge > 1 Then Exit Sub
   If Target.Address(0, 0) = "DK1" Then
      Range("D4:D590").AutoFilter 1, Target.Value
   End If
End Sub

Now, I would like to add one more criteria.

So basically when I select a value from dropdown list located at cell DK1 it will filter range D4:D590 based on DK1 cell selection and I would like to hide all zero and blank values in the range DO4:DO590 with it.

Thank you.
 
Did you get rid of the existing filter?
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Yeah, I have removed them all. There is no filter right now. Problem still occurs.
 
Upvote 0
Do you have data all the way from col D to col DO?
Is your data in a structured table or just a normal range?
Is the sheet protected?
 
Upvote 0
So, I have changed 112 to 116 in the code and it is working perfectly now.
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,702
Members
449,048
Latest member
81jamesacct

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