取消选择过滤器中的数组

时间:2018-04-12 17:34:48

标签: vba excel-vba excel

帮助我在特定excel中取消过滤数组,复制并粘贴到新标签中。 Unililtering一个项目运作良好。在未过滤阵列中的3个以上项目时发生运行时错误。下面只是我宏的一个示例。

宏观解释:

  

- >打开excel                       - >来自A栏的未过滤器“COW”                       - >复制&粘贴在名为“Unfilter one item”的新选项卡中                      (效果很好)                       - >回到第一个标签                       - >删除旧过滤器                       - >在H列中取消过滤2个以上的项目(运行时错误                        发生)                       - >复制&粘贴在名为“Unfilter 3 item”的新选项卡中

帮助解决此错误

Sub Unfilter()


    Workbooks.Open Filename:="D:\sahana\REPORTS\Delivery Acceptance\2018\Mar\27-03-2018\ORCA Performance Report.xlsb"
    Selection.AutoFilter Field:=1, Criteria1:="<>COW"
        Range("A1").Select
        Range(Selection, Selection.End(xlToRight)).Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Copy
    Sheets.Add After:=ActiveSheet
        ActiveSheet.Name = "Unfilter one item"
        ActiveSheet.Paste



    Windows("ORCA Performance Report.xlsb").Activate
    Selection.AutoFilter
    Selection.AutoFilter Field:=8, Criteria1:=Array("<>HR Existing U900", "<>IBC Capacity 2014", "<>IBC 4G Retail Shops"), Operator:=xlFilterOutValues
    Range("A1").Select
        Range(Selection, Selection.End(xlToRight)).Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Copy
    Sheets.Add After:=ActiveSheet
        ActiveSheet.Name = "Unfilter 3 item"
        ActiveSheet.Paste

    End Sub

0 个答案:

没有答案