advanced filter office 2007

T

tina

Hi
I recently upgraded to office 2007 and my macro does not do the advanced
filter correctly now only putting in headings no data . If I stop macro do
advanced filter it works . I recorded advanced filter and put in macro which
then fails but worked while recording.
below is appropiate part of macro
Columns("A:G").Select
Range("A:G").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"I1:I2"), CopyToRange:=Range("K1"), Unique:=False
Any ideas ?
Thank you
Tina
 
J

joel

See if these changes help

with ActiveSheet
.Columns("A:G").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=.Range("I1:I2"), _
CopyToRange:=.Range("K1"), Unique:=False
end wit
 
T

tina

Thank you for the reply Joel
unfortunatly exactly same result
the data is from a microsft query but I copied and paste special values to
new sheet and copied new macro of advanced filter while copying it worked
when ran after failed
so weird
Regards
Tina
 
J

joel

What type of VBA sheet is the code in (Thisworkbook, Worksheet, Module
Class Module, Userform)? Have you tried to disable events? Are ther
any event driven macros that is part of the problem?


Application.enableEvents = False

I don't know the reason or the answer I'm just trying to figure ou
what might be interferring with the filtering inside a macro
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top