title: Excel VBA - variable for loop
body: <p>I can't seem to get my second for loop right. I'm looking for the cell with value 'Persoonlijke prijslijst'. Once I have this cell I need to go up two and delete 8 down. When I debug, it says temp = 0 so I presume it's in my second for loop.</p>
  
  <pre><code>Dim i As Integer
  For i = 1 To 800
      Range("C" &amp; i).Select
      If Range("C" &amp; i).Value = "Persoonlijke prijslijst" Then
          Dim temp As Integer
          For temp = i - 2 To temp + 8
              Range("C" &amp; temp).EntireRow.Delete Shift:=xlToLeft
          Next temp
      End If
  Next i
  </code></pre>