View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default How to loop through all ranges in a worksheet

What do you mean by ranges?
Do you use named ranges or do you want to loop through all cells
in the worksheet.

Or all cells in a range(a1:c20 or so)

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Nanette" wrote in 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.