Answers for "excel vba check if string entirely lowercase"

VBA
4

excel vba check if string entirely uppercase

'Two separate VBA functions to check if string is 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

'If you have changed Excel VBA's default for comparing text values to:
'Option Compare Text
'then use this third function instead:

Function IsUpper(s) As Boolean
    With CreateObject("VBScript.RegExp")
        .Pattern = "^[^a-z]*$"
        IsUpper = .test(s)
    End With
End Function
Posted by: Guest on April-30-2020
3

excel vba check if string entirely lowercase

'Two separate VBA functions to check if string is 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

'If you have changed Excel VBA's default for comparing text values to:
'Option Compare Text
'then use this third function instead:

Function IsLower(s) As Boolean
    With CreateObject("VBScript.RegExp")
        .Pattern = "^[^A-Z]*$"
        IsLower = .test(s)
    End With
End Function
Posted by: Guest on April-30-2020

Code answers related to "VBA"

Browse Popular Code Answers by Language