ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Rows (https://www.excelbanter.com/excel-programming/277452-delete-rows.html)

Jon[_11_]

Delete Rows
 

-----Original Message-----
I need my macro to delete rows that start with specfic

data, not clear the
row but delete. If row begins with text "bo501" delete.
T.I.A.
Dayton




.

Try this as an example. For your case the If statement
should check the value to see if it is equal to "bo501".

The problem with this macro is that it is very slow on
large data files. This is because the sheet is updated
after every delete. I've been looking for a method to
select all the rows found and then do a delete of all of
them at the same time, however, I haven't found any help
in that department.

Sub test()
For Each rw In Worksheets("Sheet1").Rows
If IsEmpty(rw.Cells(1, 1).Value) Then rw.Delete
Next rw
End Sub



All times are GMT +1. The time now is 05:41 PM.

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