Have you placed this code in the Sheet module of the sheet you want it to run against (it MUST be in the sheet module -- if it is in any other module, it will not run automatically)?
Also, since you original code was temporarily disabling events, if it errored out before turning them back on, events would be disabled and this code would not run automatically.
You can manually run this bit of code to turn them back on:
VBA Code:
Private Sub ReEnableEvents()
Application.EnableEvents = True
End Sub
and then try again.
If i press enter the cursor would just go down one cell.
Are you actually changing the value of the cell, or just going to it and pressing ENTER?
The code is only activated when a value in the cell is manually
changed.
Also note that I just went with the logic you originally had in your code, which is case-sensitive - so it is looking for entries of "Yes" and "No".
Entries like "YES", "yes", "NO", and "no" would NOT trigger the code.
If we wanted to make the code case-insensitive so it would work on any of those entries, then we would need to modify it like this:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address(False, False)
Case "B5"
If UCase(Target.Value) = "YES" Then
Range("B6").Select
ElseIf UCase(Target.Value) = "NO" Then
Range("B9").Select
End If
Case "C1"
If UCase(Target.Value) = "YES" Then
Range("B3").Select
ElseIf UCase(Target.Value) = "NO" Then
Range("B4").Select
End If
Case "C2"
If UCase(Target.Value) = "YES" Then
Range("E5").Select
ElseIf UCase(Target.Value) = "NO" Then
Range("F5").Select
End If
End Select
End Sub
If none of this works, then please provide an example where it is not working, i.e. tell us what cell you are updating with what value, and if you have made any changes to the code, please post the revised code you are using.