Changing Case On Data Entry
In Excel97 and later versions, you can use the Worksheet_Change event
procedure to automatically change the case of the text when the data is
entered. In the sheet module for the worksheet that contains the cells you
want to have updated, enter the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1:A10")) Is Nothing Then
Target(1).Value = UCase(Target(1).Value)
End If
Application.EnableEvents = True
End Sub
This will automatically change the case of the data when the user enters
data in the range A1:A10. Change this range to the range you need to use for
your application.
The code Application.EnableEvents = False prevents the Worksheet_Change
event from calling itself as it changes the value of the target cell.
You can modify this code as described in the previous section to force the
entered values to be in either lower or proper case.