UCASE

UCASE(string)

Returns the text string with all the characters converted to uppercase (Variant / String).


stringThe text string (String).

REMARKS
* If "string" = "" (zero length string), then a zero length string is returned.
* If "string" is vbNullString, then a zero length string is returned.
* All non letter characters remain unchanged.
* You can use the LCASE function to return a text string with all the characters converted to lowercase.
* You can use the STRCONV function to convert to propercase.
* You can use the UCASE$ function to return a String data type instead of a Variant data type.
* The equivalent Excel function is Application.WorksheetFunction.UPPER
* The equivalent .NET function is [[Microsoft.VisualBasic.Strings.UCase]]
* For the Microsoft documentation refer to learn.microsoft.com

Debug.Print UCase("UPPERCASE")    '= "UPPERCASE"  
Debug.Print UCase("UpperCase") '= "UPPERCASE"
Debug.Print UCase("uppercase") '= "UPPERCASE"
Debug.Print UCase("123ABC456") '= "123abc456"
Debug.Print UCase("7890") '= "7890"
Debug.Print UCase("%*$#&!") '= "%*$#&!"

Dim sResult As String
sResult = UCase("aBcDe")
Debug.Print sResult '= "ABCDE"

sResult = UCase("")
Debug.Print "'" & sResult & "'" '= "''"

sResult = UCase(vbNullString)
Debug.Print "'" & sResult & "'" '= "''"

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top