VBA Function: LCase
The VBA LCase function converts a string to lowercase.
Usage:
LCase(text)
Examples of Usage
Converting a string to lowercase:
Sub example()
emailAddress = "Example@TEST.com"
emailAddress = LCase(emailAddress)
MsgBox emailAddress 'Returns: example@test.com
End Sub
Using the LCase function to check if a string is lowercase:
Sub example()
usrName = "Cactus_37"
'Test if the username is equal to its value converted to lowercase
If usrName = LCase(usrName) Then
MsgBox "Yes, the username is in lowercase."
Else
MsgBox "No, the username contains uppercase letters." 'Displays this result
End If
End Sub
The inverse function that converts to uppercase is the UCase function.