I am trying to write a VBA code that automatically augments the value in cell E11 based on a combination of the event of another cell changing to specific parameters.
My issue is that the VBA code I have written does this semi-automatically and not fully automatically. Is there any other way to make this occur automatically based on these if sentences
Private Sub Worksheet_Change(ByVal Target As Range)
Set Actus = Range("B24")
Set Def_F = Range("E11")
If Target.Address = "$E$11" And Target.Value = "1" And Actus.Value = "CPTA" Then
MsgBox "Try Again"
Target.Value = "0"
ElseIf Target.Address = "$E$11" And Target.Value = "0" And Actus.Value = "DPTA" Then
MsgBox "Again, Again"
Target.Value = "1"
ElseIf Target.Address = "$B$24" And Target.Value = "CPTA" And Def_F.Value = "1" Then
MsgBox "Failed, Again"
Def_F.Value = "0"
ElseIf Target.Address = "$B$24" And Target.Value = "DPTA" And Def_F.Value = "0" Then
MsgBox "Having fun today?"
Def_F.Value = "1"
Else: Exit Sub
End If
End Sub