View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How to loop through all ranges in a worksheet

You're right, that's not what I want it to do.

I have a named range and I want to test if it exists (i.e.
that nobody has deleted it accidentally.) So yes, I want
to be able to loop through all of the named ranges in
either the workbook or the worksheet. Is there a way to do
that? Thanks.

Nanette
-----Original Message-----
I think you don't understand what Count does.

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


The error message you are getting is because the VBE wants
you to define a Range.

i.e.
--------
..Range("A1:A5").Count
--------

Would return 5

Count does not return a count of Range Objects that have
been defined for that worksheet.


.