View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Excel VBA - Cells Counting Problem

Hi Wumin,

To return the number of alpha cells, try the following function:

Function CountAlphas(CountRange As Range) As Long
Dim cell As Range
Dim iCtr As Long

For Each cell In CountRange
If Not IsEmpty(cell) Then
If Not cell.Value Like "*[0-9]*" Then
iCtr = iCtr + 1
End If
End If
Next
CountAlphas = iCtr
End Function


---
Regards,
Norman



"wuming " wrote in message
...
i know that to count the number of cells that contain any text you can
use:
=COUNTIF(data,"*")

what if i want to differentiate the data as alphabetic data and
alphanumeric data?
eg. COUNTIF(A1:D4,"*") returns 16 when all cells have data like:
abc125 or abc

How do u differentiate data as alphanumeric (abc125) and alphabethic
(abc) data?? PLs help me?


---
Message posted from http://www.ExcelForum.com/