excel vba check if string entirely lowercase code example
Example 1: excel vba check if string entirely uppercase
Function IsUpper(s) As Boolean
IsUpper = Len(s) And Not s Like "*[!A-Z]*"
End Function
Function IsUpper(s) As Boolean
IsUpper = UCase(s) = s
End Function
Function IsUpper(s) As Boolean
With CreateObject("VBScript.RegExp")
.Pattern = "^[^a-z]*$"
IsUpper = .test(s)
End With
End Function
Example 2: excel vba check if string entirely lowercase
Function IsLower(s) As Boolean
IsLower = Len(s) And Not s Like "*[!a-z]*"
End Function
Function IsLower(s) As Boolean
IsLower = LCase(s) = s
End Function
Function IsLower(s) As Boolean
With CreateObject("VBScript.RegExp")
.Pattern = "^[^A-Z]*$"
IsLower = .test(s)
End With
End Function