title: Excel VBA overlapping error for deleting highlighted rows
body: <p>I'm trying to understand why this error pops up when it didn't before</p>
  
  <pre><code>Sub deleterow()
     Dim cell As Range, DelRange As Range
  
     For Each cell In ActiveSheet.Range("A2:G2000")
         If cell.Interior.ColorIndex = 6 Then
             If DelRange Is Nothing Then
                 Set DelRange = cell
             Else
                 Set DelRange = Union(DelRange, cell)
             End If
         End If
      Next cell
  
     If Not DelRange Is Nothing Then DelRange.EntireRow.Delete ' error here
  End Sub
  </code></pre>
  
  <p>This is part of a recorded VBA macro for deleting highlighted rows but it's showing an error Run time error "1004" - "cannot use that command on overlapping selection" in the line DelRange.EntireRow.Delete.</p>
  
  <p>It didn't occur before.</p>
  
  <p>Thanks in advance</p>