Home > Software engineering >  how to splite excel data from vartical to horizontal using specific number of rows
how to splite excel data from vartical to horizontal using specific number of rows

Time:11-23

I need my file to be like this:

enter image description here

in the screen I choose the number of rows/column is 10

my request id how to get my data splited like the example using specific number of rows/column

CodePudding user response:

I have modified one of my macros I use day-to-day. You can play with this.
p.s. Active cell must be the first cell of your data.

Sub split_by_ten()
If MsgBox("Are you sure?", vbOKCancel) = vbCancel Then
Exit Sub
Else
Application.ScreenUpdating = False
    Dim i, j
    i = ActiveCell.Row
    j = 3
    Do Until Cells(i, 1) = ""
            Range(Cells(i, 1), Cells(i   9, 1)).Select
            Selection.Copy
            Cells(3, j).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, 
SkipBlanks:=False, Transpose:=False
        i = i   10
        j = j   1
    Loop
    Application.ScreenUpdating = True
    MsgBox "done !"
End If
End Sub
  • Related