嘗試下面的代碼中(修改 「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
你已經發布的代碼位可能的工作。沒有看到小組的其他成員,很難從你發佈的內容中知道你的問題。 –