x means Y
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. |
x means Y
hi
sounds like all you need to do is add an entry into your auto correct options. 2003 toolsautocorrect optionsfollow the wizard. regards FSt1 "MitzDriver" wrote: 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. |
x means Y
"MitzDriver" wrote in message
... 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 -- Ian -- |
x means Y
Perfect....you guys are great.
Thanks for the help!!! "IanC" wrote: "MitzDriver" wrote in message ... 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 -- Ian -- |
All times are GMT +1. The time now is 05:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com