ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete based on results of formula (https://www.excelbanter.com/excel-programming/284430-delete-based-results-formula.html)

Steve R[_2_]

Delete based on results of formula
 
In the code below, I am able to delete rows that have a
value of less than one. What I really want to do is to
delete rows where (A1 + B1)<1, (A2 + B2)<1, and so on.

How do I write a simple formula like the above that is
similar to the below? Thanks in advance.



Range("a1").Select
While ActiveCell < ""
If ActiveCell < 1 Then
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
Wend

Tom Ogilvy

Delete based on results of formula
 
Range("a1").Select
While ActiveCell < ""
If ActiveCell + ActiveCell.Offset(0,1) < 1 Then
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
Wend

--
Regards,
Tom Ogilvy

"Steve R" wrote in message
...
In the code below, I am able to delete rows that have a
value of less than one. What I really want to do is to
delete rows where (A1 + B1)<1, (A2 + B2)<1, and so on.

How do I write a simple formula like the above that is
similar to the below? Thanks in advance.



Range("a1").Select
While ActiveCell < ""
If ActiveCell < 1 Then
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
Wend




sr

Delete based on results of formula
 
Perfect. Thank you.
-----Original Message-----
Range("a1").Select
While ActiveCell < ""
If ActiveCell + ActiveCell.Offset(0,1) < 1 Then
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
Wend

--
Regards,
Tom Ogilvy

"Steve R" wrote in

message
...
In the code below, I am able to delete rows that have a
value of less than one. What I really want to do is to
delete rows where (A1 + B1)<1, (A2 + B2)<1, and so on.

How do I write a simple formula like the above that is
similar to the below? Thanks in advance.



Range("a1").Select
While ActiveCell < ""
If ActiveCell < 1 Then
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
Wend



.



All times are GMT +1. The time now is 12:23 AM.

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