Win XP, Office 2003
I have a worksheet containing +- 900 rows.
In col F, certain cells have text values, others are blank.
How do I delete ONLY the rows in which the cells in col F are blank?
Hi,
just spent hours on this myself.
The below works for me.
\Craig
Sub TWODelete_with_Autofilter_removing_NA()
Dim DeleteValue As String
Dim rng As Range
Sheets("Invoice Summary - Split").Select
Range("A1").Select
DeleteValue = "#N/A"
' This will delete the rows with "#N/A" in the Range("B:B")
With ActiveSheet
.Range("B:B").AutoFilter Field:=1, Criteria1:=DeleteValue
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete
End With
.AutoFilterMode = False
End With
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
End Sub