Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Autofilter Properties

Hi All
I am interested in discovering how I can access the
autofilter object-properties (if at all?).

I'll explain what I am trying to do..

If I set an autofilter on a worksheet with a column of
related text, the drop-down appears in which the unique
list of values in that column appears. Is there an object
or property I can access from VBA for that list?

In a similar vain, if I set a filter on the first column,
any other columns autofilter drop down list is restricted
to values for that column based on the rows selected by
the first filter. Again I wish to access this list from
VBA.

TIA
Nigel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Autofilter Properties

the list is not available through VBA.

--
Regards,
Tom Ogilvy

"Nigel" wrote in message
...
Hi All
I am interested in discovering how I can access the
autofilter object-properties (if at all?).

I'll explain what I am trying to do..

If I set an autofilter on a worksheet with a column of
related text, the drop-down appears in which the unique
list of values in that column appears. Is there an object
or property I can access from VBA for that list?

In a similar vain, if I set a filter on the first column,
any other columns autofilter drop down list is restricted
to values for that column based on the rows selected by
the first filter. Again I wish to access this list from
VBA.

TIA
Nigel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Autofilter Properties

Maybe you could use the same technique that John Walkenbach does to fill a
listbox with unique entries:

http://j-walk.com/ss/excel/tips/tip47.htm

And you could use the same kind of thing for the secondary columns. Just loop
through the visible cells in that column.



Nigel wrote:

Hi All
I am interested in discovering how I can access the
autofilter object-properties (if at all?).

I'll explain what I am trying to do..

If I set an autofilter on a worksheet with a column of
related text, the drop-down appears in which the unique
list of values in that column appears. Is there an object
or property I can access from VBA for that list?

In a similar vain, if I set a filter on the first column,
any other columns autofilter drop down list is restricted
to values for that column based on the rows selected by
the first filter. Again I wish to access this list from
VBA.

TIA
Nigel


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Autofilter Properties

Thanks Dave, great tip. I used a collection to build the unique list as
suggested by John Walkenbach. The collection properties yields the stuff I
needed. Having used an autofilter I wrapped the Collection.Add with
Cell.EntireRow.Hidden to only fill the collection with the visible rows
after applying the filter. It works great!

'Code snippet follows
' This example is based on a tip by J.G. Hussey,
' published in "Visual Basic Programmer's Journal"
' adpated by John Walkenbach

Dim AllCells As Range, Cell As Range
Dim NoDupes As New Collection

' The items are in A2:A106, autofilter applied to column A
Set AllCells = Range("A2:A106")

On Error Resume Next
For Each Cell In AllCells
If Not Cell.EntireRow.Hidden Then
NoDupes.Add Cell.Value, CStr(Cell.Value)
End If
Next Cell

' collection NoDupes contains non duplicated, filtered items in chosen range
only


Cheers
Nigel



"Dave Peterson" wrote in message
...
Maybe you could use the same technique that John Walkenbach does to fill a
listbox with unique entries:

http://j-walk.com/ss/excel/tips/tip47.htm

And you could use the same kind of thing for the secondary columns. Just

loop
through the visible cells in that column.



Nigel wrote:

Hi All
I am interested in discovering how I can access the
autofilter object-properties (if at all?).

I'll explain what I am trying to do..

If I set an autofilter on a worksheet with a column of
related text, the drop-down appears in which the unique
list of values in that column appears. Is there an object
or property I can access from VBA for that list?

In a similar vain, if I set a filter on the first column,
any other columns autofilter drop down list is restricted
to values for that column based on the rows selected by
the first filter. Again I wish to access this list from
VBA.

TIA
Nigel


--

Dave Peterson



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Autofilter Properties

One might want to consider checking the reference to Microsoft Scripting
Runtime and using a Dictionary Object rather than a Collection; more
versatile and, I believe, significantly faster, primarily because the
entire set of data can be transferred from the Dictionary directly
without looping.

Alan Beban

Nigel wrote:
Thanks Dave, great tip. I used a collection to build the unique list as
suggested by John Walkenbach. The collection properties yields the stuff I
needed. Having used an autofilter I wrapped the Collection.Add with
Cell.EntireRow.Hidden to only fill the collection with the visible rows
after applying the filter. It works great!

'Code snippet follows
' This example is based on a tip by J.G. Hussey,
' published in "Visual Basic Programmer's Journal"
' adpated by John Walkenbach

Dim AllCells As Range, Cell As Range
Dim NoDupes As New Collection

' The items are in A2:A106, autofilter applied to column A
Set AllCells = Range("A2:A106")

On Error Resume Next
For Each Cell In AllCells
If Not Cell.EntireRow.Hidden Then
NoDupes.Add Cell.Value, CStr(Cell.Value)
End If
Next Cell

' collection NoDupes contains non duplicated, filtered items in chosen range
only


Cheers
Nigel



"Dave Peterson" wrote in message
...

Maybe you could use the same technique that John Walkenbach does to fill a
listbox with unique entries:

http://j-walk.com/ss/excel/tips/tip47.htm

And you could use the same kind of thing for the secondary columns. Just


loop

through the visible cells in that column.



Nigel wrote:

Hi All
I am interested in discovering how I can access the
autofilter object-properties (if at all?).

I'll explain what I am trying to do..

If I set an autofilter on a worksheet with a column of
related text, the drop-down appears in which the unique
list of values in that column appears. Is there an object
or property I can access from VBA for that list?

In a similar vain, if I set a filter on the first column,
any other columns autofilter drop down list is restricted
to values for that column based on the rows selected by
the first filter. Again I wish to access this list from
VBA.

TIA
Nigel


--

Dave Peterson




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
excel 2007 autofilter change to 2003 autofilter functionality? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 10:05 PM
2007 excel autofilter back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 3 April 19th 10 08:11 PM
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
2007 Autofilter worse than 2003 Autofilter jsky Excel Discussion (Misc queries) 9 October 31st 07 12:14 AM
How to Sort within AutoFilter with Protection on (and AutoFilter . giblon Excel Discussion (Misc queries) 1 February 16th 06 12:23 PM


All times are GMT +1. The time now is 07:13 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"