Count of all non empty "records"
You may want to try this (You can also use the Offset function to move
around cells):
Public Sub Test()
Dim ntRow As Integer
Dim RecordCount As Integer
Worksheets(1).Select
ntRow = 2
RecordCount = 0
For Each cell In Range("A1:P65536")
If cell.Value < "" Then
RecordCount = RecordCount + 1
End If
Next
MsgBox (RecordCount)
End Sub
"Cynthia" wrote in message
news:AUsmc.42375$I%1.2758026@attbi_s51...
Hi all,
I would like to get a count of all non empty "records" (range of Ax:Px)
and tried to use this code,
but it keeps returning 32767...is this the correct way?
intRow = 2
RecordCount = 0
For i = intRow To Rows.Count
If Sheet2.Range("A" & intRow & ":P" & intRow).Value < "" Then
RecordCount = RecordCount + 1
Else
Exit For
End If
Next
Thank you
Cindi
|