VBA复制粘贴自动筛选后的内容

VBA复制粘贴自动筛选后的内容:

Sub sx()
    If Dir("D:\VBA\xx.xls") <> "" Then
        Workbooks.Open Filename:="D:\VBA\xx.xls"
    Else
        GoTo ERR
    End If
    Range("A1").Select
    With Selection
                  .AutoFilter Field:=1, Criteria1:=0
                  .SpecialCells(xlCellTypeVisible).Copy Sheets("Temp").Range("A1")
    End With
    
ERR: MsgBox "发现非法数据存在,程序终止!", 16
End Sub


你可能感兴趣的:(VBA)