Attachment 291795Hello Tinbendr,
I had to make a change to the second worksheet, see attached, I added a second column from the first worksheet "Buying Entity ID (COID)" I need to do the samething, add the 320 so GL codes to each of the two columns from the second worksheet. Please help
Sub BreakOut()
Dim WSAccts As Worksheet
Dim WSsrc As Worksheet
Dim WSdest As Worksheet
Dim AryAccts() As Variant
Dim AryCC As Variant
Dim AryFinal As Variant
Dim A As Long
Dim B As Long
Dim C As Long
Dim LRAccts As Long
Dim LRCC As Long
Set WSAccts = Worksheets("GLUpdate")
Set WSsrc = Worksheets("COID-CC")
Set WSdest = Worksheets.Add
With WSAccts
LRAccts = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
With WSsrc
LRCC = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
ReDim AryCC(LRCC)
ReDim AryAccts(1 To LRAccts, 1 To 5)
ReDim AryFinal(1 To LRAccts * LRCC, 1 To 5)
AryAccts = WSAccts.Range("A2:E" & LRAccts)
AryCC = WSsrc.Range("A2:A" & LRCC)
WSdest.Range("A1:E1").Value = Sheet1.Range("A1:E1").Value
For B = 1 To LRCC - 1
For A = 1 To LRAccts - 1
C = C + 1
AryFinal(C, 1) = AryAccts(A, 1)
AryFinal(C, 2) = AryCC(B, 1)
AryFinal(C, 3) = AryAccts(A, 3)
AryFinal(C, 4) = AryAccts(A, 4)
AryFinal(C, 5) = AryAccts(A, 5)
Next
Next
WSdest.Range("A2").Resize(LRAccts * LRCC, 5) = AryFinal
End Sub
Bookmarks