M
mattg
Hi,
I'm currently using this code to delete rows with balnk cells. However, i
have changes the formatting of my sheet and the cells are no longer blank
they have the "#DIV/0!" error. How can I delete the entire row when the cell
in column D has that value?
Sub DeleteRowsIfDIsBlank()
With payrollsht
Dim rg As Range, rgBlank As Range
Set rg = Cells.Range("D")
On Error Resume Next
Set rgBlank = rg.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If rgBlank Is Nothing Then
Else
rgBlank.EntireRow.Delete
End If
End With
End Sub
I'm currently using this code to delete rows with balnk cells. However, i
have changes the formatting of my sheet and the cells are no longer blank
they have the "#DIV/0!" error. How can I delete the entire row when the cell
in column D has that value?
Sub DeleteRowsIfDIsBlank()
With payrollsht
Dim rg As Range, rgBlank As Range
Set rg = Cells.Range("D")
On Error Resume Next
Set rgBlank = rg.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If rgBlank Is Nothing Then
Else
rgBlank.EntireRow.Delete
End If
End With
End Sub