Home |
Search |
Today's Posts |
|
#1
|
|||
|
|||
Delete specified critria rows
Hi
What code can I use to delete rows based on the values of two fields/columns on the same row. (if cell A1 is not blank and cell B1=0 delete) Thanks. |
#2
|
|||
|
|||
Insert a row at the top, and then a spare column, add
=AND(A2<"",B2=0) Select this column and Menu DataAuItofilter. Click the dropdown and select TRUE from the list Delete all visible rows, including row 1 All done -- HTH RP (remove nothere from the email address if mailing direct) "rn" wrote in message ... Hi What code can I use to delete rows based on the values of two fields/columns on the same row. (if cell A1 is not blank and cell B1=0 delete) Thanks. |
#3
|
|||
|
|||
Thanks.
-----Original Message----- Insert a row at the top, and then a spare column, add =AND(A2<"",B2=0) Select this column and Menu DataAuItofilter. Click the dropdown and select TRUE from the list Delete all visible rows, including row 1 All done -- HTH RP (remove nothere from the email address if mailing direct) "rn" wrote in message ... Hi What code can I use to delete rows based on the values of two fields/columns on the same row. (if cell A1 is not blank and cell B1=0 delete) Thanks. . |
#4
|
|||
|
|||
Sub DeleteRows()
Dim iLastRow As Long Dim i As Long Application.ScreenUpdating = False iLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = iLastRow To 1 Step -1 With Cells(i, "A") If .Value < "" And _ .Offset(0, 1).Value = 0 Then .EntireRow.Delete End If End With Next i Application.ScreenUpdating = True End Sub --- HTH Jason Atlanta, GA -----Original Message----- Hi What code can I use to delete rows based on the values of two fields/columns on the same row. (if cell A1 is not blank and cell B1=0 delete) Thanks. . |
#5
|
|||
|
|||
Thanks for your help.
-----Original Message----- Sub DeleteRows() Dim iLastRow As Long Dim i As Long Application.ScreenUpdating = False iLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = iLastRow To 1 Step -1 With Cells(i, "A") If .Value < "" And _ .Offset(0, 1).Value = 0 Then .EntireRow.Delete End If End With Next i Application.ScreenUpdating = True End Sub --- HTH Jason Atlanta, GA -----Original Message----- Hi What code can I use to delete rows based on the values of two fields/columns on the same row. (if cell A1 is not blank and cell B1=0 delete) Thanks. . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do I delete all rows that match a condition? | Excel Worksheet Functions | |||
delete repeating rows | Excel Worksheet Functions | |||
delete empty rows between rows with text | Excel Discussion (Misc queries) | |||
How to delete duplicate rows in Excel 2000? | Excel Discussion (Misc queries) | |||
How do I delete blank rows at the bottom of a spreadsheet to get . | Excel Discussion (Misc queries) |