user3061876
user3061876

Reputation: 161

Move to new row every 4th column

I got data that is stored in one row of columns in an excel sheet. Is there a way to move data to next row every 4th column? Is there a built in function for this? For example:

Data:

Actinium | Ac | 89 | 227.0278* | Aluminum | Al | 13 | 26,981539 ...

Output:

Actinium |Ac | 89 | 227.0278*
Aluminum |Al | 13 | 26,981539

Upvotes: 0

Views: 275

Answers (1)

user3061876
user3061876

Reputation: 161

I made a macro:

Sub dela_igen()
Dim i As Integer, j As Integer, cur_column As Integer

cur_column = 1
For i = 1 To 100
    For j = 1 To 4
        Cells(i, j).Value = Cells(1, cur_column).Value
        cur_column = cur_column + 1
    Next j
Next i

End Sub

Worked like a charm!

Upvotes: 1

Related Questions