PDA

View Full Version : Quickly Delete or Hide Rows if Column N is blank



agnesz
08-28-2008, 10:46 AM
I need to quickly delete rows in range from row 8 to 501 if column N is blank. The vba that I have takes forever. Any help would be much appreciated.
tx

Bob Phillips
08-28-2008, 11:04 AM
Dim rng As Range

Application.Calculation = xlCalculationManual
Columns("O").Insert
Range("O7").Value = "temp"
Range("O8:O501").FormulaR1C1 = "=RC[-1]="""""
Range("O7:O501").AutoFilter Field:=1, Criteria1:="TRUE"
On Error Resume Next
Set rng = Range("O8:O501").SpecialCells(xlCellTypeVisible)
If Not rng Is Nothing Then

rng.EntireRow.Delete
End If
Columns("O").Delete
On Error GoTo 0

Application.Calculation = xlCalculationAutomatic