是否可以仅从过滤的表中复制某些列,而不是所有列?
基本代码:
Sub GENERATE_click()
ThisWorkbook.Worksheets("sheet1").Range("A12:E500").AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Range("D1:F3"), _
CopyToRange:=Range("L14"), _
Unique:=False
End Sub
答案 0 :(得分:0)
请尝试以下操作(例如,仅复制B,C和E列):
Private Sub MyAdvancedFilters()
Dim lastVisibleRow As Long
With ActiveSheet
.Range("A12:E500").AdvancedFilter _
Action:=xlFilterInPlace, _
CriteriaRange:=Range("D1:F3"), _
Unique:=False
lastVisibleRow = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("B12:C" & lastVisibleRow & ",E12:E" & lastVisibleRow).Copy .Range("L14")
.ShowAllData
End With
End Sub