View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default conut rows within a range

The previous code assumed that there would be something in range A1:C200.
Here is some code that does not make that assumption.

Dim clearscnt As Range

With Worksheets("clears")
On Error Resume Next
Set clearscnt =
Union(.Range("a1:c200").SpecialCells(xlCellTypeFor mulas), _
.Range("a1:c200").SpecialCells(xlCellTypeConstants ))
On Error GoTo 0
If clearscnt Is Nothing Then
Worksheets("codes").Range("d2").Value
Else
Worksheets("codes").Range("d2").Value =
Intersect(clearscnt.EntireRow, _
.Range("a1:a200")).Count
End If
End With

HTH
Jim Thomlinson


" wrote:

jim thanks for that although i am getting an error message saying that
no cells were found

tammy