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

Is there a way to return filtered values directly to a variable without
having to step through the visible cells? For example, filtering on
column A and B reduces the filter options displayed in the column C drop
down. I want to use data values in column C dropdown list to generate
graphs. My stepping routine takes a long time (minutes, but now want
seconds...next it will be yesterday :-)
Thanks Ron


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default VBA Excel Autofilter Question

Ron

You can put the value of a range into a variant variable to create an array.

Sub GetFilteredData()

Dim vaFilter As Variant
Dim i As Long

With Sheet1
vaFilter = .Range("C2", .Range("C" & .Rows.Count).End(xlUp)).Value
End With

For i = LBound(vaFilter, 1) To UBound(vaFilter, 1)
Debug.Print vaFilter(i, 1)
Next i

End Sub

Starts at C2 to omit the header row. It only picked up visible cells when I
tested it, but I'm not sure why.

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

Ron Henze wrote:
Is there a way to return filtered values directly to a variable
without having to step through the visible cells? For example,
filtering on column A and B reduces the filter options displayed in
the column C drop down. I want to use data values in column C
dropdown list to generate graphs. My stepping routine takes a long
time (minutes, but now want seconds...next it will be yesterday :-)
Thanks Ron


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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 change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
Autofilter Question kate Excel Discussion (Misc queries) 0 April 25th 08 07:13 PM
AutoFilter Question Ram Excel Discussion (Misc queries) 6 November 27th 06 04:05 PM
Excel 2003 - Autofilter Question windsong Excel Discussion (Misc queries) 4 December 13th 05 08:11 PM


All times are GMT +1. The time now is 02:57 AM.

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"