I need to delete all blank cells down the A column of an excel table. ALL code I tried failed or does STRANGE things...
Any idea to get this right will be appreciated...TX
I tried and edited and tried...based on these lines of code....
None of the three versions does the job...
PLEASE HELP :)
Code: Select all
Sub ClearBlankRows()
Dim myR As Range, myRow As Long
'On Error Resume Next
'ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, Criteria1:="="
For Each myR In Range("Table1[DATE]").SpecialCells(xlCellTypeBlanks)
myRow = myR.Row
myR.Rows(myRow).Select
'.ListObject.ListRows(myRow).Select
Next myR
'ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1
Range("Table1[[#Headers],[DATE]]").Select
'On Error GoTo 0
End Sub
Sub ClearBlankCellsInColumnNew()
Dim rngBlanks As Excel.Range
With Worksheets("Master").ListObjects("Table1")
On Error Resume Next
Set rngBlanks = Intersect(.DataBodyRange, .ListColumns("New").Range).SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If Not rngBlanks Is Nothing Then
rngBlanks.Delete
End If
End With
End Sub
Sub T()
Dim myC As Range, i As Long
Set myC = Columns(1).SpecialCells(xlCellTypeBlanks)
For i = 1 To myC.Count
myC(i).Select
myC(i).EntireRow.Delete
Next i
End Sub