The VBA UCase Function

Related Function:
VBA LCase

Description

The VBA UCase function converts a supplied String into upper case text.

The syntax of the function is:

UCase( String )

Where the String argument is the text string that you want to convert to upper case.


VBA UCase Function Example

In the following example, the VBA UCase function is used to convert the String "John Paul Smith, dob 11/12/1982" to upper case text.

' Convert a string to upper case text.
Dim str1 As String
str1 = UCase( "John Paul Smith, dob 11/12/1982" )
' The variable str1 is now equal to "JOHN PAUL SMITH, DOB 11/12/1982"

After running the above VBA code, the variable str1 is equal to the String "JOHN PAUL SMITH, DOB 11/12/1982".

Note that the UCase function leaves punctuation and numbers unchanged.