counting records
Hi Panagiotis,
However, why not simply:
countrecords = Application.CountA(Range("A1:A500"))
---
Regards,
Norman
"Norman Jones" wrote in message
...
Hi Panagiotis,
Try:
'=============
Public Function countrecords() As Integer
Dim count As Integer
Dim cell As Range
count = 0
For Each cell In Worksheets("Saved Records").Range("A1:A500")
If Not IsEmpty(cell.Value) Then
count = count + 1
End If
Next cell
countrecords = count
End Function
'<<=============
---
Regards,
Norman
"Panagiotis Marantos" wrote
in message ...
can somebody provide me with an answer as to why the following function
returns an error on the if line?
the error message is "object required"
Function countrecords() as integer
Dim count As Integer
count = 0
For Each cell In Worksheets("Saved Records").Range("A1:A500")
If cell.Value Is Not Null Then
count = count + 1
End If
Next cell
countrecords = count
End Function
|