Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
One Entry to Multiple Rows
I have data that looks like this:
X1 | Y1 Y2 Y3 Y4 X2 | Y4 Y5 Y6 Y7 And I need to get to: X1 | Y1 X1 | Y2 X1 | Y3 X1 | Y4 X2 | Y4 ...... etc. I can change the 2nd row's entries to more columns, but that doesn't seem to get me much closer to the needed format (and there are thousands of lines so I'd rather not do it manually). Any ideas? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
One Entry to Multiple Rows
should do it. change mc to suit
'===== Option Explicit Sub lineemup() Dim mc As Long Dim mr As Long Dim i As Long Dim lc As Long mc = 3 'col c mr = 1 For i = 1 To Cells(Rows.Count, mc).End(xlUp).Row lc = Cells(i, Columns.Count). _ End(xlToLeft).Column - mc Cells(i, mc).Resize(, lc).Copy Cells(mr, mc - 1).PasteSpecial _ Paste:=xlPasteAll, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=True mr = mr + lc Next i Application.CutCopyMode = False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Pandaura" wrote in message ... I have data that looks like this: X1 | Y1 Y2 Y3 Y4 X2 | Y4 Y5 Y6 Y7 And I need to get to: X1 | Y1 X1 | Y2 X1 | Y3 X1 | Y4 X2 | Y4 ..... etc. I can change the 2nd row's entries to more columns, but that doesn't seem to get me much closer to the needed format (and there are thousands of lines so I'd rather not do it manually). Any ideas? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple data entry with multiple results | Excel Worksheet Functions | |||
Data entry on filtered rows. | Excel Worksheet Functions | |||
Inserting rows between each entry | Excel Discussion (Misc queries) | |||
page set up with blank rows between each entry | New Users to Excel | |||
Sorting with Multiple Rows per Entry | Excel Worksheet Functions |