xl vba convert and entire range to uppercase code example

Example: excel vba convert and entire range to uppercase

'To convert the entire worksheet range A1:C99 to UPPER case, use the 
'following VBA:

[a1:c99] = [index(upper(a1:c99),)]

'Or use this Sub:

Sub ToUpper(r As Range)
    r = Evaluate("index(upper(" & r.Address & "),)")
End Sub

'------------------------------------------------------------------------------

'To convert the entire worksheet range A1:C99 to LOWER case, use the 
'following VBA:

[a1:c99] = [index(lower(a1:c99),)]

'Or use this Sub:

Sub ToLower(r As Range)
    r = Evaluate("index(lower(" & r.Address & "),)")
End Sub

'
'
'

Tags:

Vb Example