Hi
Try this one.
Code:
Option Explicit
Sub kTest()
Dim k, kk(), i As Long, n As Long, c As Long, j As Long
Const TotalColumns As Long = 26
Const StaticColCount As Long = 6
With ThisWorkbook.Worksheets("before")
k = .Range("a1", .Range("a" & .Rows.Count).End(xlUp)).Resize(, TotalColumns).Value2
End With
ReDim kk(1 To UBound(k, 1) * TotalColumns, 1 To StaticColCount + 1)
n = 1
For j = 1 To StaticColCount
kk(n, j) = k(1, j)
Next
For i = 2 To UBound(k, 1)
For c = StaticColCount + 1 To UBound(k, 2)
n = n + 1
For j = 1 To StaticColCount
kk(n, j) = k(i, j)
Next
kk(n, StaticColCount + 1) = k(i, c)
Next
Next
If n Then
With ThisWorkbook.Worksheets("results")
.UsedRange.ClearContents
.Range("a1").Resize(n, UBound(kk, 2)).Value2 = kk
End With
End If
End Sub
Bookmarks