Filter on date range

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,220
Hello all

I need a clever boffin to answer this one please

The code below allows me to search multiple criteria in my workbook from the dashboard sheet pulling from the Data sheet
What I want to do if it's possible is to add a date range search (IE: from date - to date)
Example: 01-12-2019 to 28-12-2019 filtering [(Rws.Range("D4"),5]



[Set Rws = Sheets("DashBoard")
Set Dws = Sheets("Data")
Ary = Array(Rws.Range("D6"), 7, Rws.Range("D7"), 14, Rws.Range("D8"), 22, Rws.Range("D9"), 3, Rws.Range("D10"), 2, Rws.Range("F6"), 12, Rws.Range("F7"), 10, Rws.Range("F8"), 8, Rws.Range("F9"), 15)
If Dws.AutoFilterMode Then Dws.AutoFilterMode = False
With Dws.Range("A1:V1")
If Ary(0) <> "" Then .AutoFilter Ary(1), Ary(0)
If Ary(2) <> "" Then .AutoFilter Ary(3), Ary(2)
If Ary(4) <> "" Then .AutoFilter Ary(5), Ary(4)
If Ary(6) <> "" Then .AutoFilter Ary(7), Ary(6)
If Ary(8) <> "" Then .AutoFilter Ary(9), Ary(8)
If Ary(10) <> "" Then .AutoFilter Ary(11), Ary(10)
If Ary(12) <> "" Then .AutoFilter Ary(13), Ary(12)
If Ary(14) <> "" Then .AutoFilter Ary(15), Ary(14)
If Ary(16) <> "" Then .AutoFilter Ary(17), Ary(16)]

.Parent.AutoFilter.Range.Offset(1).Copy Rws.Range("C" & Rows.Count).End(xlUp).Offset(1)
End With]
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,215,079
Messages
6,122,998
Members
449,092
Latest member
masterms

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