View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Earl[_3_] Earl[_3_] is offline
external usenet poster
 
Posts: 1
Default How to loop through all ranges in a worksheet

Hi, You cannot use the range.count that way,
you can use it this way sheet1.range("a1:a33").count
Which will obviusly give you 33 as a value.

Are looking for something specifically in a range?
Earl

-----Original Message-----
I'm trying to programmatically determine if a range

exists
in an existing workbook. I'm using the following code

and
it's erroring out:

========
Set validationWkSht = ThisWorkbook.Worksheets
("Validation")
With validationWkSht
For i = 0 To .Range.Count
<stuff
Next i
End With
========

I'm getting "Compile Error: Argument not optional"
applying to ".Range.Count". Thing is, I'm trying to
use ".Range" as a collection because there's supposed to
be a range collection w/a count propery.

Can anyone help me here? Thanks.
.