Applying 2 filters via a Macro
Hi Pete,
Am Tue, 15 May 2012 16:15:53 +0000 schrieb pete212:
I have a Macro that filters column C for a certain period - this works
great. What I then what it do is filter OUT one contract number, so that
only data is shown for 3 out of the 4 contract numbers for the period
filtered.
This works as long as there is row data for each contract number during
those periods. If there isn't a row with a certain contract number
during the dates applied by the first filter, the macro falls over as it
then can't apply the second filter to data that doesnt exist. Hopefully
the code below will help explain this.
Try:
With ActiveSheet.Range("A1")
.AutoFilter Field:=1, Criteria1:=Array("3228260", "3228276", "3554229")
.AutoFilter Field:=3, Criteria2:= _
Array(1, "2/1/2011", 1, "3/1/2011", 1, "4/1/2011")
End With
Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
|