Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
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.



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
auto filter within a macro Sean Excel Discussion (Misc queries) 4 March 27th 08 11:04 AM
Auto-Filter within a Macro jeannie v Excel Discussion (Misc queries) 1 June 17th 07 10:59 AM
Auto filter run from a macro will not do the same as when done manually. ChemicalJasper Excel Discussion (Misc queries) 0 February 2nd 07 03:25 PM
Auto Filter Macro Snakeoids Excel Discussion (Misc queries) 10 August 24th 05 08:46 PM
Auto Filter in a macro hawkeyes2002[_2_] Excel Programming 0 November 14th 03 11:41 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"