ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Row IF (https://www.excelbanter.com/excel-programming/341516-delete-row-if.html)

GregR

Delete Row IF
 
I have a table begining in Row 9 that I need to delete the entire row,
if any cell in Column "F" is =0 or if any cell in Column "J" begins
with "05" or "340". There are a dynamic number of rows in the table.
TIA

Greg


Rowan Drummond[_3_]

Delete Row IF
 
Save your data before testing:

Sub delit()
Dim eRow As Long
Dim i As Long
eRow = Cells(Rows.Count, 6).End(xlUp).Row
For i = eRow To 9 Step -1
If Cells(i, 6).Value = 0 _
Or Left(Cells(i, 10).Value, 2) = "05" _
Or Left(Cells(i, 10).Value, 3) = "340" Then
Rows(i).EntireRow.Delete
End If
Next i
End Sub

Hope this helps
Rowan

GregR wrote:
I have a table begining in Row 9 that I need to delete the entire row,
if any cell in Column "F" is =0 or if any cell in Column "J" begins
with "05" or "340". There are a dynamic number of rows in the table.
TIA

Greg


GregR

Delete Row IF
 
Rowan, thank you very much...................

Greg



All times are GMT +1. The time now is 07:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com