billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
Evening All
Wondering if someone could lead me to an alternative. The below Loop deletes the row if a cell condition (Text "Test") is located in Column J, also looking to delete the 3 rows above. Coincidentally found a similar request on the forum yesterday, however unsure how to amend.
Thank You All
Wondering if someone could lead me to an alternative. The below Loop deletes the row if a cell condition (Text "Test") is located in Column J, also looking to delete the 3 rows above. Coincidentally found a similar request on the forum yesterday, however unsure how to amend.
Thank You All
Code:
Sub DeleteIfMet()
Dim lr As Long: lr = Range("J" & Rows.Count).End(xlUp).Row
For i = 2 To lr
If Cells(i, "J") = "Test" Then
Cells(i, "J").EntireRow.Delete
Cells(i, "J").Offset(-1).EntireRow.Delete
Cells(i, "J").Offset(-2).EntireRow.Delete
Cells(i, "J").Offset(-3).EntireRow.Delete
End If
Next
End Sub
Last edited: