Forum Discussion
TimStrickland
Jun 10, 2022Copper Contributor
Parsing Data from One Column to Multiple Columns
Hi all… Looking for advice I’m trying to find a quick way to sort data from one column into multiple columns in Excel 2013. Data appears in the first column with a single record on multiple rows. A...
OliverScheurich
Jun 10, 2022Gold Contributor
Sub sort_into_columns()
Dim i As Long
Dim j As Long
Dim k As Long
Dim l As Long
Dim m As Long
Dim MaxRows As Long
Range("B:BB").Clear
m = Application.InputBox("How many columns are you going to fill?")
MaxRows = Range("A" & Rows.Count).End(xlUp).Row
j = 2
k = 1
For j = 2 To m + 1
For i = 1 To MaxRows / m
Cells(i, j).Value = Cells(k + l, 1).Value
k = k + m
Next i
k = 1
l = l + 1
Next j
End Sub
You can try these lines of code. After starting the macro you only have to enter the number of columns or the number of multiple rows for a single record respectively.
- TimStricklandJun 11, 2022Copper ContributorThank you OliverScheurich. I was honestly hoping for a function/formula that might help. I’m not particularly skilled with coding. But thank you very much for your response. I’ll give it a try and see what I can manage.