|
下面是我录制的宏 能用VBA简化吗 现在的运行很慢。
Sub 数据筛选()
'
' 数据筛选 宏
'
'
Rows("2:2").Select
Selection.AutoFilter
Selection.AutoFilter
ActiveSheet.Range("$A$2:$V$2203").AutoFilter Field:=12, Criteria1:="不计"
Range("D2").Select
Range("D2:H2204").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$2:$V$2203").AutoFilter Field:=12, Criteria1:="采购"
Range("D2").Select
Range("D2:H2204").Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$2:$V$2203").AutoFilter Field:=12, Criteria1:="车间 有备货"
Range("D2").Select
Range("D2:H2204").Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$2:$V$2203").AutoFilter Field:=12, Criteria1:= _
"车间激光有备货"
Range("D2:H2204").Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$2:$V$2203").AutoFilter Field:=12, Criteria1:="单独 采购"
Range("D2:D2204").Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.Color = 15773696
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$2:$V$2203").AutoFilter Field:=12, Criteria1:="车间激光1"
Range("D2:D2204").Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$2:$V$2203").AutoFilter Field:=12, Criteria1:="车间"
Range("D2").Select
Range("D2:H2204").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Rows("2:2").Select
Selection.AutoFilter
Selection.AutoFilter
End Sub
|
|