View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default transpose rows to column (cell)

you can give this code a try, it puts the results on a separate sheet. didn't
have a lot of time to test it.

Sub test()
Dim ws As Worksheet
Dim ws2 As Worksheet
Dim lastrow As Long
Dim lastcol As Long
Dim i As Long
Dim y As Long
Dim z As Long

y = 1
Set ws = Worksheets("sheet1")
Set ws2 = Worksheets("sheet2")
lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row
lastcol = ws.Cells(1, Columns.Count).End(xlToLeft).Column
ws2.Cells.Clear
With ws
For i = 1 To lastrow
For z = 4 To lastcol
ws2.Range("A" & y & ":C" & y).Value = ws.Range("A" & i &
":C" & i).Value
ws2.Cells(y, 4).Value = ws.Cells(i, z).Value
y = y + 1
Next
Next
End With
End Sub


--


Gary Keramidas
Excel 2003


"Ghaleb Bakri" wrote in message ...
Hello,

I have the below table:

A B C D E F G H I J K L
x y z 1 2 3 4 5 6 7 8 9
c b d 2 3 4 5 6 7 8 9 2

I need to transpose as follows:

X y z 1
x y z 2
X y z 3
x y z 4
x y z 5
x y z 6
x y z 7
x y z 8
x y z 9
c b d 2
c b d 3

...etc

I really apprecite if a help can be sent to me

Thx
Ghaleb



Submitted via EggHeadCafe - Software Developer Portal of Choice
Word HTML Cleaner
http://www.eggheadcafe.com/tutorials...l-cleaner.aspx