尝试下面的代码中(修改 “Sheet6” 你的表名):
Option Explicit
Sub CopyFiltResults()
Dim FiltRng As Range
With Worksheets("Sheet6") ' modify "Sheet6" to your sheet's name
With .Range("A1:J" & .Cells(.Rows.Count, "I").End(xlUp).Row)
' set range filter column I to "Gross Sale"
.AutoFilter Field:=9, Criteria1:="Gross Sale"
Set FiltRng = .Columns(9).SpecialCells(xlCellTypeVisible)
FiltRng.Copy .Range("K1") '<-- only copy visible cells to Column K
Set FiltRng = Nothing '<-- clear range variable
' set range filter column I to "Net Sales"
.AutoFilter Field:=9, Criteria1:="Net Sales"
Set FiltRng = .Columns(9).SpecialCells(xlCellTypeVisible)
FiltRng.Copy .Range("L1") '<-- only copy visible cells to Column L
End With
End With
End Sub
你已经发布的代码位可能的工作。没有看到小组的其他成员,很难从你发布的内容中知道你的问题。 –