Forum Discussion
Keep a Value
- Nov 02, 2020
Something like that, in that direction?
If cell A2 contains the text "x"; then enter the value 9 in cell A1; otherwise "leave everything as it is"
VBA code:Private Sub Worksheet_Change (ByVal Target As Range) If Target.Address = "$ A $ 2" Then If LCase (Range ("A2")) = "x" Then Application.EnableEvents = False Range ("A1") = 9 Application.EnableEvents = True End If End If End Subor in formula?
=IF(A2="x",9,A1)
Hope I was able to help you.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here
Something like that, in that direction?
If cell A2 contains the text "x"; then enter the value 9 in cell A1; otherwise "leave everything as it is"
VBA code:
Private Sub Worksheet_Change (ByVal Target As Range)
If Target.Address = "$ A $ 2" Then
If LCase (Range ("A2")) = "x" Then
Application.EnableEvents = False
Range ("A1") = 9
Application.EnableEvents = True
End If
End If
End Sub
or in formula?
=IF(A2="x",9,A1)
Hope I was able to help you.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here