View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Auto filter macro

If the header for that column is Cost (as an example), then
Dim res as Variant
res = application.Match("Cost",Range("A1:IV1")
if not iserror(res) then
Range("A1").Autofilter Field:=res, . . .

--
Regards,
Tom Ogilvy

"Ali" wrote in message
...
My bad. I actually want that particular field no matter
what column it is in. So if I add another column it will
still point to that particula field

thanks again.


-----Original Message-----
Field:=2 selects the second column in the autofilter

range. Adding
columns to the left should have no effect.



--
Regards,
Tom Ogilvy

Ali wrote in message
...
I will like to crete a macro that will select the 2nd
column of the filter to apply even if I add more columns
later on. So if I add more columns the autfilter will
select the second column. Any ideas?

Thanks again.



.