automatic charactor replacement

  • Thread starter Thread starter Jerry
  • Start date Start date
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.
 
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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top