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 worksheet formula solution, you will still need to
answer my first question.
Rick
"Rick Rothstein (MVP -
VB)" wrote in
message ...
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 worksheet formula be acceptable?
Rick
wrote in message
...
Fellow programmers... below is some code I tried to create to detect
if the contents of the ActiveCell.Value was all UPPERCASE. The
spreadsheet 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!