Filter 7 columns and delete row on filter is "empty"

jbesclapez

Active Member
Joined
Feb 6, 2010
Messages
275
Hello,

I am using this code now to filter on 7 columns and delete the entire row if cell is empty.
But it takes too long... can you fix it or point me to the right code? I noticed the problem is when it reachers Selection.Delete Shift:=xlUp

Thanks

Code:
Sub FilterAndDeleteEmptyLines()
'
' Macro3 Macro
'
'    Cells.Select
'    Selection.ClearContents
'Application.ScreenUpdating = False
'Application.DisplayAlerts = False


    Sheets("Sheet3").Select
    Columns("A:J").Select
    Selection.Copy
    Sheets("TabWord").Select
    Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Columns("H:H").Select
    Application.CutCopyMode = False
    Selection.TextToColumns Destination:=Range("H1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
        :="#", FieldInfo:=Array(Array(1, 2), Array(2, 2)), TrailingMinusNumbers:=True
    Range("I1").Select
    ActiveCell.FormulaR1C1 = "NumWord"
    Columns("A:J").Select
    Range("J1").Activate
    Selection.AutoFilter
    ActiveSheet.Range("$A$1:$J$998").AutoFilter Field:=1, Criteria1:="="
    ActiveSheet.Range("$A$1:$J$998").AutoFilter Field:=2, Criteria1:="="
    ActiveSheet.Range("$A$1:$J$998").AutoFilter Field:=3, Criteria1:="="
    ActiveSheet.Range("$A$1:$J$998").AutoFilter Field:=4, Criteria1:="="
    ActiveSheet.Range("$A$1:$J$998").AutoFilter Field:=5, Criteria1:="="
    ActiveSheet.Range("$A$1:$J$998").AutoFilter Field:=6, Criteria1:="="
    ActiveSheet.Range("$A$1:$J$998").AutoFilter Field:=7, Criteria1:="="
    Rows("2:20000").Select
    Selection.Delete Shift:=xlUp
    ActiveWindow.SmallScroll Down:=-15
    Columns("A:J").Select
    Selection.AutoFilter
    Range("A1").Select
    
    Sheets("Sheet3").Select
    Range("AO1").Select
    
  '  Application.ScreenUpdating = True
    ' Application.DisplayAlerts = True
    
    




End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top