There are a couple ways to go about handling the potential error of trying to delete something that doesn't exist.
First, you could check to see if there are blank cells.
with worksheets("Sheet1")
with .range(.cells(1, 1), .cells(rows.count, 1).end(xlup))
if cbool(application.countblank(.columns(1))) then
.cells.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
end if
end with
end with
'earlier version of Excel may not have COUNTBLANK
with worksheets("Sheet1")
with .range(.cells(1, 1), .cells(rows.count, 1).end(xlup))
if application.counta(.columns(1)) < .rows.count then
.cells.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
end if
end with
end with
The above has the disadvantage that the COUNTBLANK function will count zero-length strings returned by formula as blanks while they are not considered trly blank by the .SpecialCells(xlCellTypeBlanks) method. However, you probably wouldn't be looking for blanks in a column you know to be populated with formulas so this is a consideration, not a deal breaker.
Next we can test for Nothing by altering the error handling method.
dim delRng as range
with worksheets("Sheet1")
with .range(.cells(1, 1), .cells(rows.count, 1).end(xlup))
'temporarily suspend error handling
on error resume next
set delRng = .cells.SpecialCells(xlCellTypeBlanks)
on error goto 0
if not delRng is nothing then
delRng.EntireRow.Delete
end if
end with
end with
Although widely accepted, I do not favor this method simply because I don't think you should have to break something in order to see if it exists but that is just my personal preference.