LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Count Cells containing Text only

Nick, think you meant to include the second argument as well:

Sub CountConstants()
Dim lConstantCount As Long
On Error Resume Next
lConstantCount = Selection.SpecialCells( _
xlCellTypeConstants,xlTextValues).Count
On Error goto 0
MsgBox "There are " & lConstantCount _
& " Cells with constants in the
selection"
End Sub

Just in case there are constant numbers in the selection as well.

--
Regards,
Tom Ogilvy


Nick Hodge wrote in message
...
Soniya

the code below will count the cells with constants. (Not formulas, blank,
etc) in a selection

Sub CountConstants()
Dim lConstantCount As Long
lConstantCount = Selection.SpecialCells(xlCellTypeConstants).Count
MsgBox "There are " & lConstantCount & " Cells with constants in the
selection"
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Soniya" wrote in message
...
Hi all,
How can I count cells containing Text only?

TIA
Soniya





 
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
Count text in cells? hoyos Excel Discussion (Misc queries) 4 February 8th 10 08:31 PM
Count blank cells and cells with text rk0909 Excel Discussion (Misc queries) 3 May 2nd 08 03:56 AM
Count single Text in cells with multiple text entries WSC Excel Discussion (Misc queries) 6 January 9th 07 04:17 PM
How do I count cells with text but ignore cells with spaces? Husker87 Excel Discussion (Misc queries) 2 September 21st 06 12:31 AM
count cells containing text Lisa W Excel Worksheet Functions 5 March 16th 06 12:48 AM


All times are GMT +1. The time now is 05:23 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"