excel vba to uppercase code example

Example 1: excel vba to upper case

Dim sText As String
sText = "Run, forrest run"
MsgBox StrConv(sText, vbProperCase)   ' Run, Forrest Run
MsgBox StrConv(sText, vbLowerCase)    ' run, forrest run
MsgBox StrConv(sText, vbUpperCase)    ' RUN, FORREST RUN
MsgBox UCase(sText)                   ' RUN, FORREST RUN

Example 2: excel vba to lower case

' To lower, upper and proper case
Dim sText As String
sText = "Run, forrest run"
MsgBox StrConv(sText, vbProperCase)   ' Run, Forrest Run
MsgBox StrConv(sText, vbLowerCase)    ' run, forrest run
MsgBox StrConv(sText, vbUpperCase)    ' RUN, FORREST RUN

Tags:

Vb Example