How do you test a string entered by the user via a userform for uppercase? If any uppercase letters are present in the string I want it to return true, it it does not contain lowercase I want it to return false...
Thanks!
Printable View
How do you test a string entered by the user via a userform for uppercase? If any uppercase letters are present in the string I want it to return true, it it does not contain lowercase I want it to return false...
Thanks!
I'm assuming you meant to say "if it does not contain uppercase I want it to return false"
This should return true if there are any uppercase letters
Quote:
Function containsUpperCase(testString As String) As Boolean
containsUpperCase = (testString <> LCase(testString))
End Function
if you want to confirm a mix of upper and lower case
vb Code:
Function casemixed(s As String) As Boolean If Not (LCase(s) = s Or UCase(s) = s) Then casemixed = True End Function