View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Autofilter Macro

It is probably better to use Advance Filter which has an option to have a
criteria range of multiple items. Try using Advance filtering from the
worksheet menu to seee how it works. another choice is to create you own
filtering using arrays

MyArray = Array("Item 1", "Item 2", "Item 3", "Item 4")

for each itm in MyArray

'add your code here
next itm

"robot" wrote:

Hello,

I have a table with a column called "Source". This column can take on any
one of 50 values. I would like to use autofilter to filter out about 30 of
them. Is it possible with autofilter & VBA?

I am thinking about using VBA to concatinate the 20 admissible source names
into one long string (strLong), then use it in an autofilter criterion on
the Source field. More specifically, I hope to find a criterion specifying
that the field value is to be part of strLong. Unfortunately, criterion such
as :="*<string*" works the other way round (ie it requires the field to
contain a certain string). So I got stuck.

Suggestions are most welcome! (I use Excel XP).