Re: Help w/ project. Counting upper and lower case characters in a cell.
- From: "RB Smissaert" <bartsmissaert@xxxxxxxxxxxxxxxx>
- Date: Sat, 18 Mar 2006 00:06:30 -0000
This is a fast function to count upper case characters.
You can work out for yourself how to do lower case.
Function CountUppers(ByVal strString As String) As Long
Dim aByte() As Byte
Dim i As Long
aByte() = strString
For i = 0 To UBound(aByte) Step 2
If aByte(i) < 91 Then
If aByte(i) > 64 Then
CountUppers = CountUppers + 1
End If
End If
Next
End Function
Sub test()
MsgBox CountUppers(Cells(1))
End Sub
RBS
<triadiemus@xxxxxxxxx> wrote in message news:1142629462.356688.267590@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Here's the task I'm trying to complete:
Take text from a cell.
Count all uppercase letters.
Count all lower case letters.
I've figured out how to count the total letters excluding spaces using
the LEN and SUBSTITUTE commands, but I'm stuck on how to count how many
uppercase and lower case letters there are. Can anyone point me in the
right direction?
.
- References:
- Help w/ project. Counting upper and lower case characters in a cell.
- From: triadiemus
- Help w/ project. Counting upper and lower case characters in a cell.
- Prev by Date: Re: vba copy number to Column as letter ' B '
- Next by Date: Re: Can Paramaters be used w/ OLE SQL Query & Excel
- Previous by thread: Help w/ project. Counting upper and lower case characters in a cell.
- Next by thread: sorting w/ blank cells
- Index(es):
Relevant Pages
|