ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Check for case of string (https://www.excelbanter.com/excel-worksheet-functions/256610-check-case-string.html)

msnyc07

Check for case of string
 
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!

Dave Peterson

Check for case of string
 
Check your other post.

msnyc07 wrote:

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!


--

Dave Peterson

Ron Rosenfeld

Check for case of string
 
On Wed, 17 Feb 2010 15:08:01 -0800, msnyc07
wrote:

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

Mike H

Check for case of string
 
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.


"msnyc07" wrote:

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!



All times are GMT +1. The time now is 03:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com