title: VBA Skipping Lines of Code
body: <p>I have a part of a macro that is being completely skipped when it is executing.  I think I probably has something to do with the if statement combined with the loop.  </p>
  
  <pre><code>For x = 1 To HomeLoop
      If Application.WorksheetFunction.CountIf(Sheet6.Range("G:G"), Sheets(1).Cells(x + 2, 1)) = 0 Then
          Sheets(1).Select
          Rows(x + 2).Select
          Selection.Delete Shift:=xlUp
      Else
      End If
  Next x
  </code></pre>
  
  <p>There is more code before and after the block.  When I'm going through the code with the debugger, the "For x = 1 to HomeLoop" will highlight and the next step goes directly to highlight the code below the "Next x"  I can't figure out why the block is being completely skipped.</p>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>Thank you.</p>