ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Write a bsice macro (https://www.excelbanter.com/excel-programming/327229-write-bsice-macro.html)

Mike B

Write a bsice macro
 
Hello,

I would like the code for a macro that does the following:
I have a spreadsheet with a header row and want to delete any rows that have
a number in columns 3,4, or 5 that is less than 70

--
Mike B

Don Guillett[_4_]

Write a bsice macro
 
see my answer to your previous post. change to 3 step -1 to to 2 step -1

--
Don Guillett
SalesAid Software

"mike b" wrote in message
...
Hello,

I would like the code for a macro that does the following:
I have a spreadsheet with a header row and want to delete any rows that

have
a number in columns 3,4, or 5 that is less than 70

--
Mike B




Mike B

Write a bsice macro
 
Not sure what you meant by what you wrote? change to 3 I assume is column 3.
what does the rest mean?

"Don Guillett" wrote:

see my answer to your previous post. change to 3 step -1 to to 2 step -1

--
Don Guillett
SalesAid Software

"mike b" wrote in message
...
Hello,

I would like the code for a macro that does the following:
I have a spreadsheet with a header row and want to delete any rows that

have
a number in columns 3,4, or 5 that is less than 70

--
Mike B





Don Guillett[_4_]

Write a bsice macro
 
You posted " Macro syntax - how to find them" and apparently never checked
back for the answer. Here is my original answer modified.

from the bottom up something like

Sub sortanddelete()
ActiveSheet.UsedRange.Sort Key1:=Range("b2"), _
Order1:=xlAscending, Header:=xlYes
For i = Cells(Rows.Count, "b").End(xlUp).Row To 2 Step -1
If Cells(i, 3) < 70 Or Cells(i, 4) < 70 Or Cells(i, 5) < 70 Or _
Cells(i, 6) = "D" Or Cells(i, 7) = "D" Or Cells(i, 8) = "D" Or _
Cells(i, 6) = "E" Or Cells(i, 7) = "E" Or Cells(i, 8) = "E" Or _
Cells(i, 9) < 100 Or Cells(i, 2) = Cells(i - 1, 2) _
Then Rows(i).Delete
Next i
End Sub

--
Don Guillett
SalesAid Software

"mike b" wrote in message
...
Not sure what you meant by what you wrote? change to 3 I assume is column

3.
what does the rest mean?

"Don Guillett" wrote:

see my answer to your previous post. change to 3 step -1 to to 2 step -1

--
Don Guillett
SalesAid Software

"mike b" wrote in message
...
Hello,

I would like the code for a macro that does the following:
I have a spreadsheet with a header row and want to delete any rows

that
have
a number in columns 3,4, or 5 that is less than 70

--
Mike B








All times are GMT +1. The time now is 12:40 PM.

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