Option Explicit
Sub test()
Dim ar, br, cr, i&, j&, Rng As Range, iPosRow&
cr = Array(1, 2, 6, 3, 18, 21, 23, 19, 24, 26, 27, 28, 29, 30, 32, 34)
ar = Range("C6", Cells(Rows.Count, "AJ").End(3))
Set Rng = Sheets(2).[A1].CurrentRegion.Resize(4)
With Sheets(3)
.Cells.Clear
For i = 1 To UBound(ar)
iPosRow = (i - 1) * 5 + 1
Rng.Copy .Cells(iPosRow, 1)
With .Cells(iPosRow, 1).CurrentRegion.Resize(4)
br = .Value
For j = 0 To UBound(cr)
br(4, j + 1) = ar(i, cr(j))
Next j
br(4, 3) = br(4, 3) + ar(i, 7)
.Value = br
.EntireColumn.AutoFit
.EntireRow.AutoFit
End With
Next i
End With
Sheets(3).Activate
Beep
End Sub
|