Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Each cell in selected cells test

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

Thank you,

Steven
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple cells or columns are selected instead of selected cell or Mikey Excel Discussion (Misc queries) 1 April 29th 09 09:48 PM
Test if entire row is selected Jan Kronsell Excel Programming 2 November 19th 07 12:55 PM
Test if cells are selected Lisa[_10_] Excel Programming 6 April 2nd 07 06:03 PM
Test to see if selected range is single row? davegb Excel Programming 6 March 19th 07 09:18 PM
Macro to take selected cells times a selected cell Craig Excel Programming 4 October 24th 05 12:54 AM


All times are GMT +1. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"