Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
rn
 
Posts: n/a
Default 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   Report Post  
Bob Phillips
 
Posts: n/a
Default

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   Report Post  
Jason Morin
 
Posts: n/a
Default

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.
.

  #4   Report Post  
rn
 
Posts: n/a
Default

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.
.

.

  #5   Report Post  
rn
 
Posts: n/a
Default

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.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I delete all rows that match a condition? djhs63 Excel Worksheet Functions 5 March 16th 05 03:55 PM
delete repeating rows aledger Excel Worksheet Functions 2 March 4th 05 08:43 PM
delete empty rows between rows with text Paulo Baptista Excel Discussion (Misc queries) 2 February 28th 05 03:41 PM
How to delete duplicate rows in Excel 2000? PAL@Emory Excel Discussion (Misc queries) 1 January 28th 05 03:08 PM
How do I delete blank rows at the bottom of a spreadsheet to get . Miklaurie Excel Discussion (Misc queries) 1 January 26th 05 02:30 PM


All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"