0
我已經運行這個宏,但它正在複製每個可用的工作表,即使我提到不要複製特定的工作表。將多個表格合併爲一個排除幾張表。錯誤
Sub Combine()
Dim J As Integer
Dim ws As Worksheet
On Error Resume Next
If ws.Name <> "Invoicing" And ws.Name <> "Master Data" Then
Sheets(1).Select
Worksheets.Add
Sheets(1).Name = "Combined"
Sheets(2).Activate
Range("A1").EntireRow.Select
Selection.Copy Destination:=Sheets(1).Range("A1")
End If
For J = 2 To Sheets.Count
Sheets(J).Activate
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
Next
End Sub