ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto filter macro (https://www.excelbanter.com/excel-programming/285219-auto-filter-macro.html)

Ali[_3_]

Auto filter macro
 
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.

Tom Ogilvy

Auto filter macro
 
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.




Ali[_3_]

Auto filter macro
 
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.



.


Tom Ogilvy

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.



.





All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com