Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Autofiltering again | Excel Discussion (Misc queries) | |||
autofiltering | Excel Worksheet Functions | |||
Autofiltering | Excel Worksheet Functions | |||
AutoFiltering | Excel Discussion (Misc queries) | |||
autofiltering | Excel Discussion (Misc queries) |