title: How can I add or delete lines in multiple Excel sheets with VBA
body: <p>I've got an Excel file, where I have to enter names in one sheet, and then the other sheets are adding or deleting rows.</p>
  <p>For example I have the excel sheets <code>User</code>, <code>NumberSheet</code> and <code>GradeSheet</code>.</p>
  <p>I am entering &quot;John Doe&quot;, &quot;Jane Doe&quot; and &quot;Phil Doe&quot; into the User-Sheet, and in NumberSheet and GradeSheet, 3 Rows are added.</p>
  <p>I have this code for now:</p>
  <pre><code>Private Sub Worksheet_Change(ByVal Target As range)
  Dim KeyCells As range
  
  ' The variable KeyCells contains the cells that will
  ' cause an alert when they are changed.
  ' Start Cell is A2 because Names start there
  Set KeyCells = range(&quot;A2:A100&quot;)
  
  If Not Application.Intersect(KeyCells, range(Target.Address)) _
         Is Nothing Then
  
  ' Display a message when one of the designated cells has been
      ' changed.
      ' Place your code here.
      
      'The row in the user-Sheet, where I added or removed a user
      targetRow = Target.row - 1
      'In the Number Sheet, the row from where the names should get listed
      targetRowInNumberSheet = targetRow
      
      'The value from the cell where I entered the name
      vlue = Target.Value
      
      If IsEmpty(vlue) Then
        'Delete row in Worksheets
        Worksheets(&quot;NumberSheet&quot;).Rows(targetRowInNumberSheet).Delete
        Worksheets(&quot;GradeSheet&quot;).Rows(targetRowInNumberSheet ).Delete
      Else
        'Add row in Worksheets
        Worksheets(&quot;NumberSheet&quot;).Rows(targetRowInNumberSheet).Insert
        Worksheets(&quot;GradeSheet&quot;).Rows(targetRowInNumberSheet ).Insert
      End If
  End If
  End Sub
  </code></pre>
  <p>Now this code works if I add a name, delete one or insert a row somewhere in between.
  But I can't delete multiple names, or delete a row. In both cases <code>IsEmpty(vlue)</code> will be false, and I don't know why</p>