title: VBA - How to handle the data validation error?
body: <p>I have a protected workbook. It works perfectly fine. Until we counter the below error.</p>
  
  <p>Data validation is used on one of the cells, where the user is not allowed to enter a date before 01/01/1970 and it throws an error when we do so. </p>
  
  <p>But the concern is when we click on "Retry or cancel". I get runtime error which is causing the problem. Once we encounter the error it affects other fields with VBA enabled(VBA on other fields will not work until we close and open a fresh spreadsheet). How do we handle such error?
  Please suggest</p>
  
  <p><a href="https://i.stack.imgur.com/nU3tn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nU3tn.png" alt="Data Validation"></a></p>
  
  <p><a href="https://i.stack.imgur.com/JtWMS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JtWMS.png" alt="Message Prompt"></a></p>
  
  <p><a href="https://i.stack.imgur.com/eFjEQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eFjEQ.png" alt="Runtime error"></a></p>
  
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
          Application.EnableEvents = False
          Dim myValue
          With Application
              myValue = Target.Formula
              .Undo
              Target.Formula = myValue
          End With
          Application.CutCopyMode = False
  
          If Not Intersect(Target, Range("E43")) Is Nothing Then
              With Range("E44")
                  If Target.Value = "Specific Number of Days" Then
                      .Locked = False
                      .Activate
                  Else
                      'This handles **ANY** other value in the dropdown
                      .Locked = True
                      '.Clear
                  End If
              End With
              ElseIf Not Intersect(Target, Range("E30")) Is Nothing Then
                  If Target.Value = "YES" Then Call Notify Else Call NotifyUser
              ElseIf Not Intersect(Target, Range("E31")) Is Nothing Then
                  If Target.Value = "YES" Then Call Delta Else Call DeltaUser
          End If
         Application.EnableEvents = True
      End Sub
  </code></pre>