VBA question

  • Thread starter Thread starter ub
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top