Does this help?
![]()
Sub Michael_BU() Dim i As Long For i = 2 To Range("A" & Rows.count).End(3).Row Range(Cells(i, 1), Cells(i, 13)).Copy Sheets("INPUT").Range("A" & Rows.count).End(3)(2) Next i End Sub
Does this help?
![]()
Sub Michael_BU() Dim i As Long For i = 2 To Range("A" & Rows.count).End(3).Row Range(Cells(i, 1), Cells(i, 13)).Copy Sheets("INPUT").Range("A" & Rows.count).End(3)(2) Next i End Sub
Well, this will copy all the columns, but if the column order in the 2 sheets is different, then it will not work correctly I suppose.
Any solutions for that problem?
Try:
![]()
Sub Michael_BU() Dim i As Long Dim z As Long Dim x As String Dim y As Range With Application .ScreenUpdating = False .Calculation = xlCalculationManual End With For i = 2 To Range("A" & Rows.count).End(3).Row For z = 1 To ActiveSheet.UsedRange.Columns.count x = Cells(1, z).Value Set y = Sheets("INPUT").Rows(5).Find(x, LookIn:=xlValues, lookat:=xlWhole) If Not y Is Nothing Then Cells(i, z).Copy Sheets("INPUT").Cells(Rows.count, y.Column).End(3)(2) End If Set y = Nothing Next z Next i With Application .ScreenUpdating = True .Calculation = xlCalculationAutomatic End With End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks