excelnoobhere
Board Regular
- Joined
- Mar 11, 2019
- Messages
- 61
I have the following code that deletes the entire row if its value is 900.
I want the code to be able to remove any row that is between 001 to 140 with the addition of 900
but I'm keeping 001 and 140
only the numbers in between
for example: if my row contain 141 keep, 140 keep, 139 delete, 000 keep, 001 keep 002 delete, 900 delete and so on
thanx in advance
Code:
Sub RemoveRows900()
Dim i As Long
i = 1
Do While i <= ThisWorkbook.ActiveSheet.Range("AA7:AA1000").CurrentRegion.Rows.Count
If InStr(1, ThisWorkbook.ActiveSheet.Cells(i, 1).Text, "900", vbTextCompare) > 0 Then
ThisWorkbook.ActiveSheet.Cells(i, 1).EntireRow.Delete
Else
i = i + 1
End If
Loop
End Sub
I want the code to be able to remove any row that is between 001 to 140 with the addition of 900
but I'm keeping 001 and 140
only the numbers in between
for example: if my row contain 141 keep, 140 keep, 139 delete, 000 keep, 001 keep 002 delete, 900 delete and so on
thanx in advance