Autofilter in another sheet using VBA

后端 未结 1 1917
自闭症患者
自闭症患者 2021-01-26 01:47

I intend to filter values that begins with 314 in column F, and clear its contents(entire row). The workbook has 30,000+ rows and I think looping is not a good option when filte

相关标签:
1条回答
  • 2021-01-26 02:33

    this should work ,

    Sub filter()
       Dim ws As Worksheet
       Set ws = Sheets("sheet1")
    
       ws.Range("$A$1:$AF$30436").AutoFilter Field:=6, Criteria1:="=314*" _
        , Operator:=xlAnd
    
       Dim LR As Long
       LR = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
       ws.Range("A2:AF" & LR).SpecialCells(xlCellTypeVisible).ClearContents
       ws.AutoFilterMode = False
    End Sub
    
    0 讨论(0)
提交回复
热议问题