我具有下面的宏设置并正在运行,但是它将粘贴来自第一张纸的数据多少倍。不是从每个工作表到工作表报告的数据。
有人可以帮助我为什么会这样吗!
Sub apply_autofilter_across_worksheets()
Dim xWs As Worksheet
Dim x As String
On Error Resume Next
For Each xWs In Worksheets
If xWs.Name <> "Report" Then
xWs.Range("A1").AutoFilter 14, ">0"
xWs.Range("A1", Cells(Rows.Count, "A").End(xlUp)).Resize(, 17).Select
Selection.Copy
Worksheets("Report").Activate
Worksheets("Report").Range("x1").Select
Worksheets("Report").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
End If
Next
End Sub