View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default automatic charactor replacement

You can use this worksheet Change event to do that...

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo FixItUp
If Target.Column = 4 Then
If UCase(Target.Value) = "XYZ" Then
Application.EnableEvents = False
Target.Value = "ABC"
End If
End If
FixItUp:
Application.EnableEvents = True
End Sub

My example code above applies this functionality to Column D... change the
test in the first If..Then statement to the column number you want it
applied to. As written, it is case sensitive requiring an all upper case
XYZ. If you want case insensitivity, change the second If..Then statement to
this instead...

If UCase(Target.Value) = "XYZ" Then

--
Rick (MVP - Excel)


"Jerry" wrote in message
...
I have a column in which want to automatically control information entered.
As an example if someone enters XYZ I want it to automatically change to
ABC.