Each cell in selected cells test

  • Thread starter Thread starter Steven
  • Start date Start date
S

Steven

If I select cells A1:K100, how do I count how many are blank.

Thank you,

Steven
 
Sub countblankcells()
'MsgBox Selection.SpecialCells(xlCellTypeBlanks).Count
For Each c In range("a1:k10") 'Selection
If Len(Application.Trim(c)) < 1 Then mc = mc + 1
Next c
MsgBox mc
End Sub
 
Don,

I would have thought the line you commented out would do it ('MsgBox
Selection.SpecialCells(xlCellTypeBlanks).Count). Doesn't that work? I
guess it's so you'd count cells with spaces in them as blanks, but I wonder
if that's what Steven wants.

Thanks,

Doug
 

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