title: VBA For next loop until last row of a column though not last row of sheet
body: <p>I'm trying to run a For Next Loop until the last row of a specific column (but not the last row of the sheet). So the first part of my list has data in column F and the second part doesn't. I only want the macro to apply to that first part. For some reason the loop only runs through the first part with certain commands but doesn't with the ones I am trying to do now. (I know it would be easy just to seperate the two parts manually and then run it but it drives me nuts not knowing what it is I did wrong :)).</p>
  
  <p>This is the code:</p>
  
  <pre><code>Dim i As Integer
  Dim g As Double
  g = 0.083333333
  Dim lastrow As Long
  lastrow = Sheets("zm").Range("f" &amp; Rows.Count).End(xlUp).Row
  
  Sheets("zm").Activate
  
  For i = 2 To lastrow
  
      If Sheets("zm").Cells(i, 1) = Sheets("zm").Cells(i + 1, 1) And Sheets("zm").Cells(i, 5) = Sheets("zm").Cells(i + 1, 5) And Sheets("zm").Cells(i + 1, 6) - Sheets("zm").Cells(i, 7) &lt; g Then
          Sheets("zm").Cells(i + 1, 7).Copy
          Sheets("zm").Cells(i, 7).Select
          ActiveSheet.Paste
          Application.CutCopyMode = False
          Sheets("zm").Rows(i + 1).Delete
      End If
  
  Next i
  </code></pre>
  
  <p>Thanks for your help!</p>