i'm learning VBA Excel and i have a problem with my project
Here the code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim score As String, result As String
score = Range("A1").Value
If score = "1" Then
result = "book1"
ElseIf score = "2" Then
result = "book2"
Else
result = "wrong"
End If
Range("A1").Value = result
End Sub
i try to make the insert statement , when i insert "1" in "A1" then the result is "book1"
this is when the value is "1"
this is after i click enter button and the result is "book1"
and this is the result when i click enter button once more
it happen because when i click the first enter , the system read value is "1" so system return "book1", but when second enter the system read the value is "book1" and return "Wrong"
so how can i do to make the system only ready the first value every i enter or move cell
Thanks guys , sory for my bad english



book1orbook2already?