x means Y

M

MitzDriver

How can I change a cell to either "Y" or "N" if the user enters "x".
i.e. If the user enters "x" in G12 and presses enter or moves to another
cell, that cell, G12, changes to "Y". Or the user enters "x" in H12 and
presses enter or moves to another cell, that cell, H12, changes to "N".

Thanks in advance for any help. And I hope I made sense.
 
F

FSt1

hi
sounds like all you need to do is add an entry into your auto correct options.
2003> tools>autocorrect options>follow the wizard.

regards
FSt1
 
I

IanC

MitzDriver said:
How can I change a cell to either "Y" or "N" if the user enters "x".
i.e. If the user enters "x" in G12 and presses enter or moves to another
cell, that cell, G12, changes to "Y". Or the user enters "x" in H12 and
presses enter or moves to another cell, that cell, H12, changes to "N".

Thanks in advance for any help. And I hope I made sense.

This solution works in Excel 2000 so will most likely work in newer
versions. Each time a cell is changed, the code looks at G12 & H12 to see if
either of them contain x. Note that it is case specific so entering X will
have no effect.

I don't know if you are familiar with using code in Excel. If not, then open
your worksheet, right-click on the tab and select "View code". In the window
that opens, copy the code into the top left pane. If there is already some
code there, copy this code at either the beginning or the end, not in the
middle.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo sub_exit
If Not Intersect(Target, Range("G12")) Is Nothing Then
With Target
If .Value = "x" Then
.Value = "Y"
End If
End With
End If
If Not Intersect(Target, Range("H12")) Is Nothing Then
With Target
If .Value = "x" Then
.Value = "N"
End If
End With
End If
sub_exit:
Application.EnableEvents = True
End Sub
 

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

Similar Threads


Top