View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default SpecialCells Select problem

In a light test I cannot recreate your discrepancy.
Maybe this is misleading you -
determined by stepping through debug.printing ASN(n).


If ASN is a multi-area range, which no doubt it is, you need to do

for each rArea in ASN.Areas
for each cel in rArea
debug.? cel.address, cel.value
or
for n = 1 to rArea.count
debug.? rArea(n).whatever
next: next

Regards,
Peter T


"G Lykos" wrote in message
...
Peter, thanks for the information and suggestion. In this case, there are
670 cells in the list, of which two are filtered out. Please see my
separate post just now to OssieMac describing three apparent BUGS related

to
invisible cells in a selection - if you should have further information,

I'm
certainly interested.

Regards,
George


"Peter T" <peter_t@discussions wrote in message
...
Hi George,

SpecialCells has a limit of 8192 areas, could that be the problem. If so
work with chunks of up to 16000 rows at a time in the entire selection.

Regards,
Peter T


"G Lykos" wrote in message
...
Help! Have the following snippet, am running into a problem were the
autofilter screens out two records in the data set but the selection

set
number of items and the selection set count are different!

Selection.Autofilter Field:=110, Criteria1:="<Test"
Range("A1").CurrentRegion.Sort , Header:=xlYes, _
Key1:=Range("DG1"), Key2:=Range("AZ1")
Range("DG1").Offset(1).Select
Range(Selection,
Selection.End(xlDown)).SpecialCells(xlCellTypeVisi ble).Select
Set ASN = Selection
iMax = ASN.Count

The final selection count, and iMax, reflect the correct number of

visible
cells. However, range ASN contains all cells, both visible and

invisible,
determined by stepping through debug.printing ASN(n). Why am I

picking
up
invisible cells in the selection set, and how can the selection set

count
be
different than the number of selection set elements??

A subsequent work-around was to copy the entire worksheet after

filtering
and sorting and paste it into a scratch worksheet, then set ASN there,

but
I'd much prefer to avoid that gyration. Any ideas?

Windows XP, Excel 2003 SP3.

Thanks!
George