I don't understand your question.
The code I suggested (as well as the manual technique) can be used to copy to a
new location.
This is the portion that would do the copy:
if visrng is nothing then
'warning message???
else
visrng.copy _
destination:=worksheets("Somesheetnamehere").range("a1")
end if
What I was asking was can I read thru the Range rather than just copy it to
a new location. I have tried using VisRng.Cells(x,y), where x and y are the
row and column in the range.
On another point, I tried the code you posted and I get inconsistent results
depending on the filter setting.
Sheet 1 contains some test data as follows the highlighted row marked c1,
c2, c3 and c4 has the autofilter.
c1 c2 c3 c4
1 2 3 4
1 22 33 44
2 333 444 555
2 3333 4444 5555
1 33333 44444 55555
using the range setting .....
Set VisRng = .Offset(1, 0).Resize(.Rows.Count - 1)_
.Cells.SpecialCells(xlCellTypeVisible)
and testing the range rows count using
VisRng.Rows.Count
with no filter I get 5 as expected
with filter in column 1 set to '2' I get 2 as expected
with filter in column 1 set to '1' I get 2 - not expected there should be
three!
Do you know why?

Signature
Regards,
Nigel
nigelnospam@9sw.co.uk
>I don't understand your question.
>
[quoted text clipped - 103 lines]
>> >
>> > Dave Peterson
Nigel - 25 Nov 2007 09:07 GMT
Hi Dave
I have been investigating this issue and discover that the construct
With Sheets(1).AutoFilter.Range
Set VisRng = .Resize(.Rows.Count - 1).Offset(1, 0) _
.Cells.SpecialCells(xlCellTypeVisible)
End With
Results in the selected range extent being as far down as the first hidden
row less the header. All rows that are not hidden after this are ignored!
True in both xl2003 and xl2007

Signature
Regards,
Nigel
nigelnospam@9sw.co.uk
> What I was asking was can I read thru the Range rather than just copy it
> to a new location. I have tried using VisRng.Cells(x,y), where x and y are
[quoted text clipped - 134 lines]
>>> >
>>> > Dave Peterson
Nigel - 25 Nov 2007 10:23 GMT
The problem does not lye with the VisRng setting but the use of the function
VisRng.Rows.Count
This only shows the count for the first n rows that are not hidden.
Any ideas how I can access ALL rows in VisRng

Signature
Regards,
Nigel
nigelnospam@9sw.co.uk
> Hi Dave
> I have been investigating this issue and discover that the construct
[quoted text clipped - 148 lines]
>>>> >
>>>> > Dave Peterson
Dave Peterson - 25 Nov 2007 13:53 GMT
Actually, that doesn't select anything.
If you added:
visrng.select
I would bet that it selects the visible rows in that range.
> Hi Dave
> I have been investigating this issue and discover that the construct
[quoted text clipped - 163 lines]
> >>
> >> Dave Peterson

Signature
Dave Peterson
Dave Peterson - 25 Nov 2007 13:51 GMT
If you want to loop through each of the visible rows, you could do this:
> > if howmanyvisrows > 0 then
> > 'avoid the header and come down one row
[quoted text clipped - 3 lines]
> > set visrng = nothing
> > end if
Notice that the .resize() portion has been changed to a single column.
Then you can loop through each of those cells in that range:
dim myCell as range
dim HowManyCols as long
With worksheets("somesheetname").autofilter.range
howmanycols = .columns.count
'subtract one for the header.
...
For each mycell in visrng.cells
'to copy that row
mycell.resize(1, howmanycolumns).copy
'to check the value of a different cell in that same row
if mycell.offset(0,5).value = 33 then
...
next mycell
I don't have a guess what happened with your filter. I'd try it again.
> What I was asking was can I read thru the Range rather than just copy it to
> a new location. I have tried using VisRng.Cells(x,y), where x and y are the
[quoted text clipped - 144 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Dave Peterson - 25 Nov 2007 13:55 GMT
somerange.rows.count
will return the number of rows in the first area--not the total number of rows
in all the range.
For your autofilter.range, you'd want something like:
msgbox somesheet.autofilter.range.columns(1) _
.cells.specialcells(xlcelltypevisible).cells.count
> What I was asking was can I read thru the Range rather than just copy it to
> a new location. I have tried using VisRng.Cells(x,y), where x and y are the
[quoted text clipped - 144 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Nigel - 26 Nov 2007 05:30 GMT
Many thanks for your help, I have got it now!

Signature
Regards,
Nigel
nigelnospam@9sw.co.uk
> somerange.rows.count
> will return the number of rows in the first area--not the total number of
[quoted text clipped - 161 lines]
>> >
>> > Dave Peterson