我正在处理包含大量宏的现有excel文件,并希望将5个不同工作表中的可变数据复制并粘贴到其他5个工作表而不复制空白单元格。这是我到目前为止所做的,并给我运行时错误1004:
Sub Macro1()
Sheets("Hulp_IO").Select
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("IO").Select
Range("B2").Select
ActiveSheet.Paste
Sheets("Hulp_Modbus_PMSX_Lees_Tags").Select
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Modbus_Lees_Tags_PMSX").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("Hulp_Modbus_PMSX_Schrijf_Tags").Select
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Modbus_Schrijf_Tags_PMSX").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("Hulp_Modbus_Pakscan_Lees_Tags").Select
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Modbus_Lees_Tags_PackScan").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("Hulp_Modbus_Pakscan_Schrijf_Tag").Select
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Modbus_Schrijf_Tags_PackScan").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("Start").Select
End Sub