VBA question

U

ub

Hi
I have a range defined as Range("C20, L2000"). I want to find the last
record in the range that has any value and then count the number of rows in
this range
Please advise
 
G

Gary''s Student

Sub countum()
Set r = Range("C20:L2000")
Set terminus = Nothing
For Each rr In r
If IsEmpty(rr) Then
Else
Set terminus = rr
End If
Next
MsgBox (terminus.Row - r.Row + 1)
End Sub
 
Top