In VBA (Visual Basic for Applications), the UCase function converts a specified string to uppercase.
Basic syntax
VBA
Where String is the string expression you want to convert to uppercase.
UCase(String)
Example
VBA
The UCase function is useful when you want to perform case-insensitive string comparisons or ensure that text is formatted consistently in uppercase. Remember that UCase will not modify any non-letter characters, so numbers, punctuation, and spaces will be unaffected.
Note that VBA also has the opposite function called LCase which converts text to lowercase.
Sub ConvertToUppercase()
Dim originalText As String
Dim uppercaseText As String
originalText = "Hello, World!" ' Input string
uppercaseText = UCase(originalText) ' Convert to upper case
MsgBox uppercaseText ' Display the result in a message box
End Sub