I have a range of data (columns A thru I, and rows 1 to ‘varies’), with row 1 being a header row. One of the columns (column F) is location, a text field with string data. I need to cycle through the rows and delete any row that matches my criteria. In this case anytime a cell in column F begins with “PASS”, I need to delete the entire row. Here is the code I was using:
Range("F2").Select rowNum = ActiveSheet.UsedRange.Rows.Count oRange = "F2:F" & rowNum Set pRange = Range(oRange) For Each pCell In pRange If Left(Trim(pCell.Value), 4) = "PASS" Then pCell.EntireRow.Delete Else 'fall through by design End If Next
However, I just found out that if two consecutive cells in column F begin with “PASS” my code will delete the first row and skip over the second row. Any ideas on how to fix this.