ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   only deletes first row with a blank cell in column "M" (https://www.excelbanter.com/excel-programming/393674-only-deletes-first-row-blank-cell-column-m.html)

Janis

only deletes first row with a blank cell in column "M"
 
This code works but it only deletes the first row where the "M" column field
is missing. There are quite a few rows without that data I want deleted.
How come it only deletes the first one? It looks like it should work on the
whole range. Do I need to put in a loop or do I need to give it a range?

thanks

------------code------------
Sub DeleteBlanks()
With ActiveSheet
On Error Resume Next
.Columns("M").SpecialCells(xlCellTypeBlanks).Entir eRow.Delete
On Error GoTo 0
End With
End Sub

Janis

only deletes first row with a blank cell in column "M"
 
I'll repost I think it must be finding an error and going to 0.

"Janis" wrote:

This code works but it only deletes the first row where the "M" column field
is missing. There are quite a few rows without that data I want deleted.
How come it only deletes the first one? It looks like it should work on the
whole range. Do I need to put in a loop or do I need to give it a range?

thanks

------------code------------
Sub DeleteBlanks()
With ActiveSheet
On Error Resume Next
.Columns("M").SpecialCells(xlCellTypeBlanks).Entir eRow.Delete
On Error GoTo 0
End With
End Sub



All times are GMT +1. The time now is 07:22 PM.

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