I've got a macro which copies a code from one workbook to another one. My code is pretty long and I would like to shorten it if possible (also to be a bit more independent from the macro-recorder)
My code looks like this:
Workbooks("export.XLSX").Activate
Range("A2:A" & Range("A" & Rows.Count).End(xlUp).row).Copy
Workbooks("ORDERS.CSV").Activate
Range("X3").Select
Selection.End(xlDown).Offset(1, -18).Select
ActiveSheet.Paste
Workbooks("export.XLSX").Activate
This block repeats itself for different columns. Is there a way to shorten this?
More examples:
Range("C2:C" & Range("A" & Rows.Count).End(xlUp).row).Copy
Workbooks("ORDERS.CSV").Activate
Range("X3").Select Selection.End(xlDown).Offset(1, -14).Select
ActiveSheet.Paste
Workbooks("export.XLSX").Activate
Range("G2:G" & Range("A" & Rows.Count).End(xlUp).row).Copy
Workbooks("ORDERS.CSV").Activate
Range("X3").Select Selection.End(xlDown).Offset(1, -13).Select
ActiveSheet.Paste
Workbooks("export.XLSX").Activate