【发布时间】:2020-11-16 13:30:25
【问题描述】:
我正在尝试按月和发票过滤我的数据,然后为结果着色并将它们复制到数据底部的单独选项卡中,这一切正常,但它似乎为我的数据下方的每一行着色以进行复制慢了很多,而且它似乎也复制了标题,有没有办法只用数据为行着色而不复制标题?
Sub FILTERING()
strInput = InputBox("Please Enter the Month you are Analysing in the following format: Jan-20 (No Spaces)")
ActiveSheet.Range("Y1:Y1").AutoFilter Field:=25, Criteria1:=strInput
ActiveSheet.Range("A:AK").AutoFilter Field:=29, Criteria1:= _
"=INVOICED"
Purpley = RGB(228, 223, 236)
Range("A:AK").SpecialCells(xlCellTypeVisible).Interior.Color = Purpley
Dim lastRow As Long
With Sheets("Data")
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
End With
Range("A:AK").Offset(1, 0).SpecialCells(xlCellTypeVisible).Copy
Destination:=Sheets("Data").Cells(lastRow, "A")
End Sub
【问题讨论】: