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

Hi

This is the autofilter I am using to obtain filtered dat

dim myArray()
dim rngSrc as Rang
ActiveWorkSheet.UsedRange.AutoFilter Field:=1, Criteria1:="Jim", visibledropdown:=Fals
Set rngSrc = ActiveWorkSheet.AutoFilter.Range.SpecialCells(xlCe llTypeVisible
myArray=rngSrc.Cell

If I loop through rngSrc on each row, I obtain all the records
but If I put this in rngSrc.Cells in a variant array, I am obtaining only 6 records

Am I doing anything wrong here

Please help me to get over this proble

Thanks

Amar
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default AutoFiltering problem

You can't pick up a non-contiguous range of cells in an array in one
operation. You would need to loop through each visible row and populate
your array.

dim myArray()
dim rngSrc as Range, cell as range
dim i as long, j as long, rng1 as Range
ActiveWorkSheet.UsedRange.AutoFilter Field:=1, Criteria1:="Jim",
visibledropdown:=False
Set rngSrc =
ActiveWorkSheet.AutoFilter.Range.SpecialCells(xlCe llTypeVisible)
set rng1 = Intersect(columns(rngSrc.Column),rng.Src)
Redim myarray(1 to rng1.count, 1 to rngSrc.Columns.count)
i = 0
for each cell in rng1
i = i + 1
for j = 0 to rngSrc.Columns.Count - 1
myarray(i,j+1) = cell.offset(0,j).Value
next
Next

Untested.
--
Regards,
Tom Ogilvy

"Amar" wrote in message
...
Hi,

This is the autofilter I am using to obtain filtered data

dim myArray()
dim rngSrc as Range
ActiveWorkSheet.UsedRange.AutoFilter Field:=1, Criteria1:="Jim",

visibledropdown:=False
Set rngSrc =

ActiveWorkSheet.AutoFilter.Range.SpecialCells(xlCe llTypeVisible)
myArray=rngSrc.Cells

If I loop through rngSrc on each row, I obtain all the records,
but If I put this in rngSrc.Cells in a variant array, I am obtaining only

6 records,

Am I doing anything wrong here?

Please help me to get over this problem

Thanks,

Amar



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
Autofiltering again computexcel Excel Discussion (Misc queries) 6 September 14th 08 09:11 PM
autofiltering Bernie R Excel Worksheet Functions 1 February 7th 08 10:13 PM
Autofiltering Thapelo Excel Worksheet Functions 3 November 5th 07 06:44 AM
AutoFiltering Mennochio Excel Discussion (Misc queries) 1 September 15th 06 08:08 PM
autofiltering Reggiee Excel Discussion (Misc queries) 2 August 2nd 06 04:32 PM


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