View Single Post
  #7   Report Post  
Old November 17th 05, 10:08 PM posted to microsoft.public.excel.misc
Ron de Bruin
Posts: n/a
Default Delete row based on contents of cell

Hi Olivia

No, you must test for "" then in a loop
Example that test A1:A100

Sub Example2()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = 100
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "A").Value) Then
'Do nothing, This avoid a error if there is a error in the cell

ElseIf .Cells(Lrow, "A").Value = "" Then .Rows(Lrow).Delete

End If
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub

Regards Ron de Bruin

"Olivia Trimble" wrote in message
Can this be used to delete cells only if the have returned blank as a False
response to a function?

"AndyG" wrote:

The following code does a great job of finding whole blank rows and deleting

Range("B1", Range("B65536").End(xlUp)).SpecialCells _

However, could someone please tell me how to modify this for two other

1) Delete the whole row if any cell in column A: is has the contents of "SSN"

2) Delete the whole row if any cell in column C: is blank (null?)

Thank you in advance.