Re: Help w/ project. Counting upper and lower case characters in a cell.



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?


.



Relevant Pages

  • Re: question for Doug Robbins
    ... > Execution of the sub halts at this line. ... > Dim Letters As Integer, ... > a subdoc from the subdoc itself and the rest from an ...
    (microsoft.public.word.vba.general)
  • Re: Updating a table
    ... Private Sub PrintLetter_Click ... 'Letters marked before that will be sent. ... Dim strSQL As String ... report than the one I'm using to mark the letters as sent. ...
    (microsoft.public.access.formscoding)
  • RE: Output text from numbers
    ... Exit Sub ... ) Then simbol = "I" ... with letters and output a text string. ... letters quoted in the table for that input. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: question for Doug Robbins
    ... Execution of the sub halts at this line. ... then saving letters as individual files? ... Dim Letters As Integer, Counter As Integer ... a subdoc from the subdoc itself and the rest from an ...
    (microsoft.public.word.vba.general)
  • RE: Access Mail Merge to Word.doc files ?
    ... > letters, then print all in one multiple page document. ... > Private Sub Combo13_Click ... > Dim rstResultCode As ADODB.Recordset ... > Dim curCaseNumYr As Integer ...
    (microsoft.public.access.reports)