自動篩選功能
Sub 宏2() ' ' 宏2 宏 ' ' ' ActiveSheet.Range("$A$1:$K$5").AutoFilter Field:=1, Criteria1:="20001" ' ActiveSheet.Range("$A$1:$K$5").AutoFilter Field:=1, Criteria1:="30001" ' Range("A1:K4").Select ' Selection.Copy ' Range("A14").Select ' Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ ' :=False, Transpose:=False ' ActiveSheet.Range("$A$1:$K$5").AutoFilter Field:=1, Criteria1:="=20001", _ ' Operator:=xlOr, Criteria2:="=30001" ActiveSheet.Range("$A$1:$K$5").AutoFilter Field:=1, Criteria1:="=10001", _ Operator:=xlOr, Criteria2:="=30001" Range("A1:K4").Select Application.CutCopyMode = False Selection.Copy Range("A21").Select ActiveSheet.Paste End Sub 'AutoFilter Field:=1 表示第1列 'https://docs.microsoft.com/zh-cn/office/vba/api/excel.xlautofilteroperator 'https://docs.microsoft.com/zh-cn/office/vba/api/Excel.Range.AutoFilter
|
|
來自: davidwx168 > 《VBA》