ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting Rows Macro (https://www.excelbanter.com/excel-programming/424407-deleting-rows-macro.html)

Workbook

Deleting Rows Macro
 
I'd like to create a macro that will search every row in columns A:L. Every
time columns I:L do not have contents inside of it, I would like the entire
row A:L to be deleted.

Per Jessen

Deleting Rows Macro
 
Sub DeleteRows()

FirstRow = 2
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For r = LastRow To FirstRow Step -1
If WorksheetFunction.CountBlank(Range("I" & r & ":L" & r)) = 4 Then
Rows(r).Delete
End If
Next
End Sub

Hopes this helps.

---
Per

"Workbook" skrev i meddelelsen
...
I'd like to create a macro that will search every row in columns A:L.
Every
time columns I:L do not have contents inside of it, I would like the
entire
row A:L to be deleted.



Workbook

Deleting Rows Macro
 
Works like a charm! Thank you for you're help

"Per Jessen" wrote:

Sub DeleteRows()

FirstRow = 2
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For r = LastRow To FirstRow Step -1
If WorksheetFunction.CountBlank(Range("I" & r & ":L" & r)) = 4 Then
Rows(r).Delete
End If
Next
End Sub

Hopes this helps.

---
Per

"Workbook" skrev i meddelelsen
...
I'd like to create a macro that will search every row in columns A:L.
Every
time columns I:L do not have contents inside of it, I would like the
entire
row A:L to be deleted.





All times are GMT +1. The time now is 11:22 AM.

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