ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deeting rows based on entry in a cell (https://www.excelbanter.com/excel-programming/374185-deeting-rows-based-entry-cell.html)

Gazza

Deeting rows based on entry in a cell
 
Hi,

I have a user defined function that places a key word in the last column of
data, making the data easier to sort. There are hundreds of records but in
column F the function places the key word from 3 choices - Processed,
Pending, Finished. How can I set up a macro to delete all the records apart
from "Processed".

OR having allocated the keyword using the function move all the Pending
records to a separate sheet and the Finished records to a third sheet and
then tidy up any gaps.

Thanks

Gaz



Greg Glynn

Deeting rows based on entry in a cell
 
Gazza,

When deleting entire rows of data, I find it easier to start from the
bottom and work up.

Sub ZapEm()

LastRow = 1000 ' You should improve this by defining the size of your
range.

For x = LastRow to 1 step -1
if Range("F" & x).Value < "Processed" then
Range(X & ":" & x).entirerow.delete
End If
End sub


Gazza wrote:
Hi,

I have a user defined function that places a key word in the last column of
data, making the data easier to sort. There are hundreds of records but in
column F the function places the key word from 3 choices - Processed,
Pending, Finished. How can I set up a macro to delete all the records apart
from "Processed".

OR having allocated the keyword using the function move all the Pending
records to a separate sheet and the Finished records to a third sheet and
then tidy up any gaps.

Thanks

Gaz




All times are GMT +1. The time now is 02:47 AM.

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