For example, add one column in the output array.
The code will change that:
Sub ertert()
Dim x, u, v, rez(), i&, j&, k&, sampleArr
With Sheets("Sheet1").Range("A1", Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp))
x = .Value: u = .Offset(, 825).Resize(, 10).Value: v = .Offset(, 845).Resize(, 10).Value
sampleArr = .Offset(, 855).Resize(, 10).Value
End With
'ReDim rez(1 To UBound(x) * 10, 1 To 3)
ReDim rez(1 To UBound(x) * 10, 1 To 4)
For i = 1 To UBound(x)
For j = 1 To 10
If Len(u(i, j)) Or Len(v(i, j)) Or Len(sampleArr(i, j)) Then
k = k + 1: rez(k, 1) = x(i, 1): rez(k, 2) = u(i, j): rez(k, 3) = v(i, j)
rez(k, 4) = sampleArr(i, j)
End If
Next j, i
'[a:c].ClearContents: [a3:c3].Resize(k).Value = rez
[a:d].ClearContents: [a3:d3].Resize(k).Value = rez
End Sub
The array output to Sheet2 (which is placed a green arrow).
If you want to add a lot of columns, you may need change the whole code.
Bookmarks