ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA - Get array of filter values (https://www.excelbanter.com/excel-programming/361129-vba-get-array-filter-values.html)

Gary

VBA - Get array of filter values
 
I am developing a VBA program that will go through a filtered list and do
query on multiple columns. I need to create an array of the filter values
from several columns.

How do I create a list of the values for a given column?

Thanks for your help,

Gary


Dave Peterson

VBA - Get array of filter values
 
Are you looking for that list of unique items that you see when you use the
arrow on an autofiltered column?

If yes, you could use data|Filter|advance filter and filter to a new location (a
different worksheet). Debra Dalgleish shows how to do it manually:

http://www.contextures.com/xladvfilter01.html#FilterUR

You could record a macro when you did it manually if you need code.

======
An alternative, John Walkenbach shows how to fill a listbox with a unique list:
http://j-walk.com/ss/excel/tips/tip47.htm



gary wrote:

I am developing a VBA program that will go through a filtered list and do
query on multiple columns. I need to create an array of the filter values
from several columns.

How do I create a list of the values for a given column?

Thanks for your help,

Gary


--

Dave Peterson

Norman Jones

VBA - Get array of filter values
 
Hi Gary,

I am developing a VBA program that will go through a filtered list
and do query on multiple columns. I need to create an array of
the filter values from several columns.


How do I create a list of the values for a given column?



Dim arr As Variant
Dim i As Long

arr = Array("Pippo", "Pluto", "Papperino")

For i = LBound(arr) To Ubound(arr)
'Fa qualcosa, e.g.;
msgbox arr(i)
Next i






---
Regards,
Norman



"gary" wrote in message
...
I am developing a VBA program that will go through a filtered list and do
query on multiple columns. I need to create an array of the filter values
from several columns.

How do I create a list of the values for a given column?

Thanks for your help,

Gary





All times are GMT +1. The time now is 11:26 AM.

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