title: Delete method of Range class failed, when using any variation of "EntireRow.Delete"
body: <p>I'm trying to loop through all the cells in a specified column of a used range and delete any rows where the value equals that of another value specified in a variable.  However, anytime I try and use some variation of .EntireRow.Delete I get an error message:</p>
  
  <p>Run-Time Error '1004':
  Delete method of Range class failed</p>
  
  <p>I remember this working back in the day (Excel 2007) so I'm a little confused why it wouldn't work anymore.  Did MS depreciate it?  It seems like such a useful little piece of code so I can't see why they would.</p>
  
  <p>Anyways, here's the code below, if anyone can help I'd appreciate it.</p>
  
  <pre><code>Dim rngColumnRef As String
      rngColumnRef = "$A:$A"
  Dim rngDeleteValue As String
      rngDeleteValue = "X"
      Set tempRange = ActiveSheet.UsedRange.Columns(rngColumnRef)
      For i = 1 To tempRange.Rows.Count
          If ActiveCell.Value = rngDeleteValue Then
              ActiveCell.EntireRow.Delete 'this is where I get the error
          Else
              ActiveCell.Offset(1, 0).Activate
          End If
      Next i
  </code></pre>