Home |
Search |
Today's Posts |
#3
![]() |
|||
|
|||
![]()
Didn't really test this.
Assumes "start" is really the text that starts a new line. If it's something else, change the code reference to "start" Assumes that all the columns to the right of your data are empty Right click on the sheet tab, choose View Code InsertModule Paste this code Go back to Excel, select all your data Use ToolsMacroMacros and select TransposeData from the list Click on OK Sub TransposeData() Dim rng As Range Dim rngTgt As Range Dim intRow As Integer Dim intCol As Integer Dim intDataCount As Integer intRow = 0 intCol = 2 For Each rng In Selection If rng.Text = "start" Then intRow = intRow + 1 intCol = 2 Else intCol = intCol + 1 End If Cells(intRow, intCol).Value = rng.Text Next End Sub " wrote: I have a large file with many rows; let's say it looks like this: start data1 data2 data3 data4 start data1 data2 start data1 data2 data3 .... What I want to do is transpose the column to a row, and then each time the word START appears, start a new row. So the above would look like this: start data1 data2 data3 data4 start data1 data2 start data1 data2 data3 .... Any ideas? Thanks in advance, Scott |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I sort by row instead of by column? | Excel Worksheet Functions | |||
Column Auto Width and Hidden Rows | Excel Discussion (Misc queries) | |||
MACRO - copy rows based on value in column to another sheet | Excel Discussion (Misc queries) | |||
every nth cell by columns not rows.... | Excel Worksheet Functions | |||
Vary the column widths for different rows | Excel Discussion (Misc queries) |