AdvancedFilter - help please

Gregula

Board Regular
Joined
Aug 11, 2006
Messages
156
Hi Guys,

I have a problem with an Advanced Filter in that the macro returns an invalid result and I cannot identify why it is doing so.

this is my code:
Code:
Workbooks(strOutFile).Activate
Worksheets("tradebrand2").Activate
With Worksheets("tradebrand2")
Range("A1:CN1").Select

    Range("A3:CN4000").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
        "A1:A2"), CopyToRange:=Range("DA1:GN4000"), Unique:=False
End With

Workbooks(strOutFile).Activate
 Worksheets("tradebrand3").Activate
With Worksheets("tradebrand3")
Range("A1:C1").Select

    Range("A3:C500").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
        "C1:C2"), CopyToRange:=Range("F1:H500"), Unique:=False

End With

The first macro does not work, however the second macro does. There is no difference in the coding so why should it fail???

Any ideas would be welcome,

greg
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,214,665
Messages
6,120,804
Members
448,990
Latest member
rohitsomani

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