Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleteing rows based on a cell value

Status
Not open for further replies.

Roonaldez

Technical User
Dec 7, 2007
16
GB
Hi,

I am trying to write a piece of code that sums three cells, and then if the value of the sum is zero, delete the entire row...there will be a variable number of rows within the data, and any positive values need to be left.
I tried the below code, but it doesn't achieve my objective...any ideas very much appreciated.

Range("O7").Select
ActiveCell.FormulaR1C1 = "=RC[-2]+RC[-3]"
Range("O6").Select
ActiveCell.FormulaR1C1 = "REF 1"
a = Range("b7").End(xlDown).Row
Range("o7:eek:7").AutoFill Destination:=Range("o7:eek:" & a), Type:=xlFillDefault
[o7].AutoFilter Field:=1, Criteria1:="=0"
Range([o7], [o7].SpecialCells(xlLastCell)).EntireRow.Delete
Selection.AutoFilter
 
Can I suggest posting the code you ended up with in order to assist others who have similar issues?

Cheers,
Dave

"Yes, I'll stop finding bugs in the software - as soon as you stop writing bugs into the software." <-- Me

For all your testing needs: Forum1393
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top