tfriedel88
New Member
- Joined
- Aug 20, 2019
- Messages
- 4
This is my very first post so please forgive me for anything wrong with this post.
I have a workbook with one sheet. Every day, I create a new report and merge the two based off a unique ID in column "AB". This is part of the code:
My problem is that it is starting to take close to an hour to run this merge and I was told to use array transfer instead of single cell copying. I tried but I when I select, for example, a1, b1, e1, g1 and x1 and try to copy them over to the same cells in the other sheet, they only copy to cells A1:E1. How to I copy them over to the same matching cells if the criteria is met (a1 to a1 while g1 to g1). I'm not sure this is possible if there is columns in between?
Thanks in advance for any and all help!!
I have a workbook with one sheet. Every day, I create a new report and merge the two based off a unique ID in column "AB". This is part of the code:
Code:
T2 = Worksheets("Sheet1 (2)").Cells(x, 17) 'NHA
T3 = Worksheets("Sheet1 (2)").Cells(x, 10) 'ES&L Status
T4 = Worksheets("Sheet1 (2)").Cells(x, 14) 'Need dates
T5 = Worksheets("Sheet1 (2)").Cells(x, 15) 'ECD Dates
T6 = Worksheets("Sheet1 (2)").Cells(x, 16) 'shop notes
'T7 = Worksheets("Sheet1 (2)").Cells(x, 23) 'ES&L Member
T8 = Worksheets("Sheet1 (2)").Cells(x, 24) 'Tier
T9 = Worksheets("Sheet1 (2)").Cells(x, 13) 'Subzone
T10 = Worksheets("Sheet1 (2)").Cells(x, 27) 'SOID
T11 = Worksheets("Sheet1 (2)").Cells(x, 29) 'Material
T12 = Worksheets("Sheet1 (2)").Cells(x, 30) 'Material Description
T13 = Worksheets("Sheet1 (2)").Cells(x, 31) 'BOM Item Line Text 1
T14 = Worksheets("Sheet1 (2)").Cells(x, 32) 'PO# in Long Text?
T15 = Worksheets("Sheet1 (2)").Cells(x, 33) 'Date Populated
For Irow = 3 To MaxRows
If DataRange(Irow, 27) = T10 Then 'SOID
Cells(Irow, 10) = T3
Cells(Irow, 14) = T4
Cells(Irow, 15) = T5
Cells(Irow, 16) = T6
Cells(Irow, 24) = T8
If DataRange(Irow, 27) = T10 Then 'SOID
If Cells(Irow, 7) = "DETAIL" Then
If Cells(Irow, 9) <> "" Then
Cells(Irow, 29) = T11
Cells(Irow, 30) = T12
Cells(Irow, 31) = T13
Cells(Irow, 32) = T14
Cells(Irow, 33) = T15
End If
End If
End If
Cells(Irow, 28) = "Inital Run"
Irow = MaxRows
End If
Next
My problem is that it is starting to take close to an hour to run this merge and I was told to use array transfer instead of single cell copying. I tried but I when I select, for example, a1, b1, e1, g1 and x1 and try to copy them over to the same cells in the other sheet, they only copy to cells A1:E1. How to I copy them over to the same matching cells if the criteria is met (a1 to a1 while g1 to g1). I'm not sure this is possible if there is columns in between?
Thanks in advance for any and all help!!
Last edited by a moderator: