Help with Transpose Macros/VBA/Formula

Beth123

New Member
Joined
Jun 9, 2015
Messages
1
Hello, I need help on a transpose problem in Excel 2013. I have a set of data that has all it's information in one column and I would like take the cells and split them up into individual rows.

Here is my data (the information has been changed because I don't want to add sensitive information from my job):

Red
White
Blue
Green
Yellow
Pink
Purple
Black
Brown
Red
White
Blue
Green
Yellow
Pink
Purple
Black
Brown

And I would like for every 9th cell to form a new row, so it reads like this:

Row 1 - Red White Blue Green Yellow Pink Purple Black Brown
Row 2 - Red White Blue Green Yellow Pink Purple Black Brown


I have 1400 cells in one row and I need to split them up into rows by every 9th cell. I have tried and exhausted different macros and I don't know what to do. I'm open to different solutions, as long as it means that I can take this data and properly transpose it.

Thanks,

Beth123
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Welcome to the Board!

Try this macro out. Just be sure to set the proper starting row in the code:
Code:
Sub MyTransposeMacro()

    Dim myStartRow As Long
    Dim myJump As Long
    Dim myLastRow As Long
    Dim myRow As Long
    
    Application.ScreenUpdating = False
        
'   Define starting row an number of rows to transpose in each row
    myStartRow = 2
    myJump = 9
        
'   Find last row in column A
    myLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    
'   Loop through all rows
    myRow = myStartRow
    Do Until myRow >= myLastRow
        Range(Cells(myRow, "A"), Cells(myRow + myJump - 1, "A")).Copy
        Cells(myRow, "B").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
            False, Transpose:=True
        Application.CutCopyMode = False
        myRow = myRow + myJump
    Loop

'   Delete column A
    Columns("A").Delete
    
'   Select all blank rows and delete
    Range(Cells(myStartRow, "A"), Cells(myLastRow, "A")).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    
    Application.ScreenUpdating = True

End Sub
 
Upvote 0
try like this

Code:
Sub trnsp()
Dim x As Long
Application.ScreenUpdating = False
For x = 1 To Range("A" & Rows.Count).End(xlUp).Row Step 9
    Range("A" & x).Resize(9).Copy
    Range("C" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues, xlPasteSpecialOperationNone, False, True
Next x
Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top