Counting rows until a blank is reached

  • Thread starter Thread starter Blewyn
  • Start date Start date
B

Blewyn

How do I count the number of rows of data in my spreadsheet, based o
data in a specific column (some fields are blank in the body of th
data) ?

So far I have :

Range("M3").Select
Do
ActiveCell.Offset(1, 0).Activate
Loop Until (IsNull(ActiveCell.Value) = True)

which succeeds in scrolling down but doesn't stop at the last row o
data, just keeps going.

Any ideas ?

Cheers,

Blewy
 
Hi Blewyn

Try this one

MsgBox Application.WorksheetFunction.CountA(Range("M3:M" & Rows.Count))
 
Ron,

Thanks a lot - I just love those moments when you slap your head and
say "bloody hell I can do THAT ? How did I miss that for so long ?"

Never knew you could just call worksheet functions in code......doh!

Cheers,

Blewyn
 

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