Check for case of string

  • Thread starter Thread starter msnyc07
  • Start date Start date
M

msnyc07

So as I work with this VBA from coder I see you can set case of string

Is there anyway to examine case? Either If All Uppercase or if Mixed/Init
Caps is fine either way I can continue my logic.

Thanks!
 
Check your other post.
So as I work with this VBA from coder I see you can set case of string

Is there anyway to examine case? Either If All Uppercase or if Mixed/Init
Caps is fine either way I can continue my logic.

Thanks!
 
So as I work with this VBA from coder I see you can set case of string

Is there anyway to examine case? Either If All Uppercase or if Mixed/Init
Caps is fine either way I can continue my logic.

Thanks!

First letter Cap:

Dim s as String
Left(s, 1) Like "[A-Z]"

That might cover everything you need.

If you need to be sure that if the first letter is capitalized, the rest are
either ALL caps or ALL non-caps, then perhaps:

Dim s as String
Left(s, 1) Like "[A-Z]" And _
(Mid(s, 2) = UCase(Mid(s, 2)) Or Mid(s, 2) = LCase(Mid(s, 2)))
--ron
 
Hi,

Try this

If mystring = UCase(mystring) Then
MsgBox "all uppercase"
Else
MsgBox "Mixed case"
End If

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
Back
Top