Article ID: 141094
Article Last Modified on 10/11/2006
Sub Uppercase()
' Loop to cycle through each cell in the specified range.
For Each x In Range("A1:A5")
' Change the text in the range to uppercase letters.
x.Value = UCase(x.value)
Next
End Sub
Sub Lowercase()
' Loop to cycle through each cell in the specified range.
For Each x In Range("B1:B5")
x.Value = LCase(x.Value)
Next
End Sub
Sub Proper_Case()
' Loop to cycle through each cell in the specified range.
For Each x In Range("C1:C5")
' There is not a Proper function in Visual Basic for Applications.
' So, you must use the worksheet function in the following form:
x.Value = Application.Proper(x.Value)
Next
End Sub
A1: toM B1: toM C1: toM A2: sUe B2: sUe C2: sUe A3: joe SMITH B3: joe SMITH C3: joe SMITH A4: mary B4: mary C4: mary A5: LORI B5: LORI C5: LORINOTE: This sample data contains text formatted in various cases that you can use to verify how each macro works.
tell me about changing case of textFor additional information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: 163435
TITLE : VBA: Programming Resources for Visual Basic for Applications
Additional query words: 5.00a 5.00c 8.00 XL97 upper lower proper upper- lower- proper- upper-case lower-case XL
Keywords: kbhowto kbprogramming kbdtacode KB141094