I am writing to seek help in creating a macro functionality which allows you to copy two different columns from one sheet to another sheet into one column.
I manage to find a macro with a similar functionality but I keep getting a run-time error on the macro code below.
Sample file:
Please see the attachment for further details.
column_aggregation.xls
Expected output
Column B & C from Sheet1 copied & aggregated into column M under sheet called = output.
Code:
Any further assistance would be very much appreciated. Many thanks for your time and feedback.![]()
Sub copy2Columns() Dim lRow As Long lRow = Sheets("Output").Range("M" & Rows.Count).End(xlUp)(2).Row 'If lRow < 5 Then lRow = 5 Range("B2:B").Copy Destination:=Sheets("Output").Range("M" & lRow) Range("C2:C").Copy Destination:=Sheets("Output").Range("M" & Rows.Count).End(xlUp)(2) End Sub
Bookmarks