ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   script does not delete blank rows (https://www.excelbanter.com/excel-programming/393670-script-does-not-delete-blank-rows.html)

Janis

script does not delete blank rows
 
When I run this script from either the workbook where the worksheet is
located or from my personal.xls workbook it does not delete the rows that
have blank cells in column ("M"). It doesn't seem to do anything. It
compiles but it doesn't run. I still have all the rows with blank cells in
column "M" which are not needed for this report.

thanks,


Sub DeleteRows()
With ActiveSheet
On Error Resume Next
Columns("M").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
On Error GoTo 0
End With
End Sub

Vergel Adriano

script does not delete blank rows
 
Janis,

It seems like you missed a "."


So, replace this line

Columns("M").SpecialCells(xlCellTypeBlanks).Entire Row.Delete

With this

.Columns("M").SpecialCells(xlCellTypeBlanks).Entir eRow.Delete


--
Hope that helps.

Vergel Adriano


"Janis" wrote:

When I run this script from either the workbook where the worksheet is
located or from my personal.xls workbook it does not delete the rows that
have blank cells in column ("M"). It doesn't seem to do anything. It
compiles but it doesn't run. I still have all the rows with blank cells in
column "M" which are not needed for this report.

thanks,


Sub DeleteRows()
With ActiveSheet
On Error Resume Next
Columns("M").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
On Error GoTo 0
End With
End Sub



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

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