Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Reading data from a filtered list

I need some brain surgery, or the answer to the following:
I'd like to read two columns of data displayed by a filter into an array.
Assume that the data is already filtered by column A when the file is opened.

Cheers.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Reading data from a filtered list

Dim vArr()
Dim maxnum as Long, i as Long
Dim cell as Range

maxnum = Activesheet.Autofilter.Range _
.columns(1).specialCells(xlVisible).Count - 1
if maxnum = 0 the exit sub
redim varr(1 to maxnum, 1 to 2)
i = 1
for each cell in ActiveSheet.Autofilter.Range.columns(1).Cells
if cell.Row < ActiveSheet.Autofilter.Range.row then
if cell.EntireRow.Hidden = False then
varr(i,1) = cell.value
varr(i,2) = cell.offset(0,1).Value
i = i + 1
end if
end if
next
Redim
You could also use specialcells to get just the visible rows. this might be
faster.

--
Regards,
Tom Ogilvy


"Lucas Soler" wrote in message
...
I need some brain surgery, or the answer to the following:
I'd like to read two columns of data displayed by a filter into an array.
Assume that the data is already filtered by column A when the file is

opened.

Cheers.




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
How to bind filtered data in list box? Vinod Excel Discussion (Misc queries) 1 January 11th 10 01:59 PM
Dropdown list and filtered data Kerrie Wood 45693[_2_] Excel Discussion (Misc queries) 8 April 2nd 09 01:57 PM
Getting data from a filtered list Gaetan Excel Discussion (Misc queries) 2 August 17th 07 02:02 PM
Grabbing the filtered data in a list? [email protected] Excel Worksheet Functions 3 August 23rd 06 03:33 AM
Grabbing the filtered data in a list? [email protected] Excel Worksheet Functions 0 August 22nd 06 09:59 PM


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