ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Each cell in selected cells test (https://www.excelbanter.com/excel-programming/416796-each-cell-selected-cells-test.html)

steven

Each cell in selected cells test
 
If I select cells A1:K100, how do I count how many are blank.

Thank you,

Steven

Don Guillett

Each cell in selected cells test
 
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 Guillett
Microsoft MVP Excel
SalesAid Software

"Steven" wrote in message
...
If I select cells A1:K100, how do I count how many are blank.

Thank you,

Steven



Doug Glancy

Each cell in selected cells test
 
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

"Don Guillett" wrote in message
...
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 Guillett
Microsoft MVP Excel
SalesAid Software

"Steven" wrote in message
...
If I select cells A1:K100, how do I count how many are blank.

Thank you,

Steven





Don Guillett

Each cell in selected cells test
 
My testing showed that it didn't. Forgot to delete.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Doug Glancy" wrote in message
...
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

"Don Guillett" wrote in message
...
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 Guillett
Microsoft MVP Excel
SalesAid Software

"Steven" wrote in message
...
If I select cells A1:K100, how do I count how many are blank.

Thank you,

Steven






Doug Glancy

Each cell in selected cells test
 
I tried it a little and it seemed to work fine.

Doug

"Don Guillett" wrote in message
...
My testing showed that it didn't. Forgot to delete.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Doug Glancy" wrote in message
...
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

"Don Guillett" wrote in message
...
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 Guillett
Microsoft MVP Excel
SalesAid Software

"Steven" wrote in message
...
If I select cells A1:K100, how do I count how many are blank.

Thank you,

Steven








All times are GMT +1. The time now is 07:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com