automatic charactor replacement

J

Jerry

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.
 
F

FSt1

hi
auto correct options.
2003 on the menu bar...
tools>auto correct options
type in what you want replaced and what to replace it with.

Regards
FSt1
 
R

Rick Rothstein

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
 
G

Gord Dibben

Tools>Autocorrect

Roll your own.

I'm sure there are more cases than just your example so post back with more
details if you want code.


Gord Dibben MS Excel MVP
 
Top