Advanced Filtering on an inactive sheet

S

Spencer

i have a sheet that contains a database of products. Range("Products"). The
criteria range is above it ("FilterCriteria"). This sheet is not hidden, but
is not active. i have a userform with a combobox to choose a filter criteria
for the range. For some reason, when the sheet is not active, the filtering
does not work. so does the sheet need to be active or is there a workaround?
thanks.
 
M

merjet

Yes, there are work-arounds. I believe it would help to know what you
want to do with the filtered data before suggesting one.

Hth,
Merjet
 
R

rgablejr

i have a sheet that contains a database of products. Range("Products"). The
criteria range is above it ("FilterCriteria"). This sheet is not hidden, but
is not active. i have a userform with a combobox to choose a filter criteria
for the range. For some reason, when the sheet is not active, the filtering
does not work. so does the sheet need to be active or is there a workaround?
thanks.

Good evening Spencer,
You'll want to ensure the appropriate range names are used in the
advanced filter instead of cell references. For example,

Range("Products").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:= Range("FilterCriteria"), Unique:=False

Using this technique, you will not have to select the worksheet
containing the database/criteria for the filter to work correctly.

Have a good weekend,

Ray R. Gable, Jr.
 

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