Re: Detect UPPERCASE in cell value?



Depending on your answer to my question AND assuming you want a VB function, one of these should work for you. The first one reports True if Text is composed **only** of letters and those letters are all uppercase; the second allows Text to have non-letters as part of it and reports True as long as the letter parts are uppercase...

Function IsUppercasedLettersOnly(Text As String) As Boolean
IsUppercasedLettersOnly = Not Text Like "*[!A-Z]*"
End Function

Function IsLetterPartUppercased(Text As String) As Boolean
IsLetterPartUppercased = Not Text Like "*[a-z]*"
End Function

If you would want a work*** formula solution, you will still need to answer my first question.

Rick


"Rick Rothstein (MVP - VB)" <rick.newsNO.SPAM@xxxxxxxxxxxxxxxxxx> wrote in message news:OgJiViN7IHA.1204@xxxxxxxxxxxxxxxxxxxxxxx
Your request is not totally clear. What if the contents of the cell have numbers or punctuation marks included with its all uppercase letters... would you want TRUE or FALSE for that condition? Also, do you really want a VB coded function or would a work*** formula be acceptable?

Rick


<Internetdomainowner@xxxxxxxxxxx> wrote in message news:6139d6e2-9d0e-4ee9-ba9b-b0414b307e3a@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fellow programmers... below is some code I tried to create to detect
if the contents of the ActiveCell.Value was all UPPERCASE. The
spread*** is importing data and if a cell's value is all updercase
it means something specific with the data that being imported. Any
ideas as to how to make a TRUE & FALSE statement based on the
characters being all uppdercase?

Declare Function IsCharUpper Lib "user32" Alias "IsCharUpperA" _
(ByVal cChar As Byte) As Long
Sub Button22221_Click()

If IsCharUpper(ActiveCell.Value) = True Then
MsgBox "It is bitch.", vbOKOnly, "-Test-"
End If

If IsCharUpper(ActiveCell.Value) = False Then
MsgBox "It's not uppercase.", vbOKOnly, "-Test 2-"
End If

End Sub


Thanks in advance!


.