title: VBA loop through column to compare each cell with variable and delete the row if it doesn't match
body: <p>I'm currently trying to create a loop that will look at column C starting from row 5 and compare each cell in that column until it reaches the last used cell in that column. 
  Each cell would be checked against 8 variables to see if it matches. If the cell doesn't match any of variables the entire row must be deleted. </p>
  
  <p>My current attempt looks like: </p>
  
  <pre><code>Dim AC as long
  Dim LastRow as long
  AC=5
  LastRow= Activesheet.range("A" &amp; Rows.count).end(xlup).row
  For AC = 5 To LastRow
              With Cells(AC, "C")
              Do Until Cells(AC, "C").Text = OC1 Or Cells(AC, "C").Text = OC2 Or Cells(AC, "C").Text = OC3 Or Cells(AC, "C").Text = OC4 Or Cells(AC, "C").Text = NC1 Or Cells(AC, "C").Text = NC2 Or Cells(AC, "C").Text = NC3 Or Cells(AC, "C").Text = NC4
                  Rows(AC).EntireRow.Delete
              Loop
          End With
      Next AC
  </code></pre>
  
  <p>This should insure that once a row has been deleted the new row that took it's place (Ex. Deleting the entire row 5 would result in row 6 becoming row 5) So it should exit the Do Loop when there is a match, grab the next line number and repeat until there is another match. Only the code keeps throwing an execution interrupted error. Can someone please tell me what I'm doing wrong? </p>