Adv filter fails in macro, works fine manually

H

headly

Excel 2007 is giving me such a headache;

Recorded macro code
Columns("B2:B2819").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("AB65000"), Unique:=True

Should extract 6 values

When run from inside a procedure it fails to extract anything;
When run manually without a macro running it works fine;
Additional info: Column A is already filtered to 1 value, now I need to get
the associated values from column B; At this point i have already ran extract
unique on column A with no problem
 
M

muddan madhu

Range("B2:B2819").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range( _
"AB65000"), unique:=True
 
O

OssieMac

Problem is Columns("B2:B2819")

Should be or Columns("B:B")
or
Range("B1:B2819")

Note that the header must be included when using advanced filter or the
first value becomes the column header in the filtered range.
 
O

OssieMac

My apologies if this post twice. I got an error when trying to post the first
time.

The problem is Columns("B2:B2819")

Should be or Columns("B:B")
or
Range("B1:B2819")

Note that the header must be included when using advanced filter or the
first value becomes the column header in the filtered range.
 

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