I am trying to transpose multiple column of rows into one column
I understand this question has been asked, I have been trying to go by previous for a while but couldn't get it to work as needed. The problem I've had with previous examples is the output doesn't come in the format I need, it groups the numbers rather then doing it sequence.
Example array is:
1 1 1
2 2 2
3 3 3
4 4 4
Output:
1
2
3
4
1
2
3
4
1
2
3
4
I know this size of data can be done in query editor in excel. But i need the sequence of data to be duplicated down 2300 lines. So my example array data would 2300 rows across which would take a lot of time to unpivot. Also the unpivot function doesn't merge the data into the order.
I've tried this example from this post but could not it get to work as needed. Get a function or sub undefined.
Sub Tester()
Dim p
'get the unpivoted data as a 2-D array
p = UnPivotData(Sheets("Sheet1").Range("A1").CurrentRegion, _
3, False, False)
With Sheets("Sheet1").Range("H1")
.CurrentRegion.ClearContents
.Resize(UBound(p, 1), UBound(p, 2)).Value = p 'populate array to sheet
End With
'EDIT: alternative (slower) method to populate the sheet
' from the pivoted dataset. Might need to use this
' if you have a large amount of data
'Dim r As Long, c As Long
'For r = 1 To Ubound(p, 1)
'For c = 1 To Ubound(p, 2)
' Sheets("Sheet2").Cells(r, c).Value = p(r, c)
'Next c
'Next r
End Sub
I'm new to VBA and haven't explored it much, I am trying to find a example for this work.
Edit
Could the example be flexible to allow column array of 500+ rows rather then matching the range of what's in the example only?