我想将一些单元格复制到另一个工作簿中。它是excel中的VBA,运行时错误1004
Sub sortout()
ActiveSheet.Range("$A$3:$BD$336").AutoFilter Field:=7
Dim i As Integer
i = 4
Dim top As Integer
top = Range("A1048576").End(xlUp).Row + 1
While i < top
If InStr(Cells(i, 7), "Daimler AG") = 0 Then
Rows(i).EntireRow.Delete
i = i - 1
top = top - 1
ElseIf InStr(Cells(i, 17), "MAJOR") = 0 Then
If InStr(Cells(i, 17), "SIGNIFICANT") = 0 Then
Rows(i).EntireRow.Delete
i = i - 1
top = top - 1
End If
'Rows(i).EntireRow.Delete
End If
i = i + 1
Wend
Rows(2).EntireRow.Delete
Range("A:G,I:O,R:V,Z:AA,AC:BD").Delete
Columns("C:C").Cut Destination:=Columns("H:H")
Columns("B:B").Cut Destination:=Columns("C:C")
Columns("H:H").Cut Destination:=Columns("B:B")
Range("C1").EntireColumn.Insert
Range("H1").EntireColumn.Insert
ChDir "C:\Users\antgal\Desktop"
Workbooks.Open Filename:= _
"C:\Users\antgal\Desktop\Reported_Changes_Daimler_CW27.xlsx"
Windows("Copy of Minutes - Changes_ITO_QGATE_2016-07-06.xlsx").Activate
Range("A3:I5").Select
Selection.Copy
Windows("Reported_Changes_Daimler_CW27.xlsx").Activate
Range("B6:J7").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
答案 0 :(得分:0)
尝试下面的内容。它会起作用
注意:复制和目的地应该相等。这就是问题所在。
Workbooks("Copy of Minutes - Changes_ITO_QGATE_2016-07-06.xlsx").Sheets("Enter your sheet name to copy").Range("A3:I5").copy Workbooks("Reported_Changes_Daimler_CW27.xlsx").Sheets("Enter your sheet name to copy").Range("B6")
请使用&#34替换您的工作表名称;输入您的工作表名称以复制&#34;