title: IsEmpty + Delete functionality confuses me...as setting a value
body: <p>Here's a question on VBA.</p>
  <p>I found a fine piece of Event Worksheet_Change code and I cannot understand a few points, below I will submit the whole macro:</p>
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
  
      If Target.Address = &quot;$A$1&quot; Then Exit Sub
      If Target.Column &lt;&gt; 1 Or Target.Cells.Count &gt; 1 Then Exit Sub
      If IsEmpty(Target) Then Exit Sub ' diablo wrote this line!
      
      If IsNumeric(Target.Value) = False Then
          Application.EnableEvents = False
          Application.Undo
          Application.EnableEvents = True
          MsgBox &quot;You entered a non-numeric value.&quot;, vbExclamation, _
              &quot;Please: numbers only in column A!&quot;
          Exit Sub
      End If
  
      Dim oldVal As Double
      Dim newVal As Double
      newVal = Target.Value
      
      Application.EnableEvents = False
      Application.Undo
      oldVal = Target.Value
      Target.Value = oldVal + newVal
      Application.EnableEvents = True
      
  End Sub
  </code></pre>
  <p>Now what really puzzles me is this seemingly simple line of code. It's meaning gets a twist in my mind when we put it in an event driven programming macro:</p>
  <pre><code>If IsEmpty(Target) Then Exit Sub
  </code></pre>
  <p>The book writes (and epicly confuses me):</p>
  <p><em>Pressing the Delete key triggers the Change event. You might want to delete a cell’s     contents and start entering a new set of numbers in an empty cell, so allow yourself the luxury of exiting the Change event if the Delete key is pressed</em></p>
  <p>--&gt; If I throw this statement out of the macro (or comment it) and I press delete I cannot remove a value by pressing delete as the book says but how this works.
  For all I know the IsEmpty returns a True Boolean answer when the cell is empty and and False when it's not. Help says (press F1 please while the cursor blinks in IsEmpty):</p>
  <p><em>Returns a Boolean value indicating whether a variable has been initialized.</em></p>
  <p>So if I enter a numeric value (the macro adds numeric values input) the value hasn't been initialized? Why it has been initialized when we press Delete? What exactly in a more specific does he mean initialized?- I may not have a clear view of what help means...</p>
  <p>Going further down on the code I can absolutely understand that since it is a Change Event when we enter a numeric value I can perfectly understand that the target is the cell chosen and the value is the number we input but we disable events further on and <strong>we are assigning again to the oldVal the target.value</strong> I suspect that undo puts back the value beforehand and the older value is there to be assigned to oldVal (if that the case please confirm) But how can we really assign this to <strong>--&gt; Target.Value?-it represents only the change that it was made</strong>.</p>
  <p>After that I can clearly understand the rest of the code. My main beef on the first line of code I mentioned <strong>I just cannot get the gist how this functionality is created...</strong></p>