close

i have multiple rows, each with varing numbers of columns. i need to
get it so that each columns has it own row. i have over 1000 columns
and was hoping to get a macro can transpose the data for me?? for
example:

I have something like this:
A347
B52915

I need it to look like this:
A3
A4
A7
B5
B2
B9
B1
B5

can someone help me?! =o)This works for me with the sample data

Sub trans()
Set rng = Range(quot;A1:F2quot;) 'The input range: adjust as needed
Sheets(quot;Sheet2quot;).Select 'delete this line is transposing
to same sheet
Range(quot;A10quot;).Select 'The start of output range:
adjust as needed
k = 0

For Each rw In rng.Rows

For Each mycell In rw.Columns
If IsEmpty(mycell) Then Exit For
If mycell.Column = 1 Then
myletter = mycell
Else
ActiveCell.Offset(rowOffset:=k, columnOffset:=0) = myletter
ActiveCell.Offset(rowOffset:=k, columnOffset:=1) = mycell
k = k 1
End If
Next

Next

End Sub

best wishes--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

gt; wrote in message ups.com...
gt;i have multiple rows, each with varing numbers of columns. i need to
gt; get it so that each columns has it own row. i have over 1000 columns
gt; and was hoping to get a macro can transpose the data for me?? for
gt; example:
gt;
gt; I have something like this:
gt; A 3 4 7
gt; B 5 2 9 1 5
gt;
gt; I need it to look like this:
gt; A 3
gt; A 4
gt; A 7
gt; B 5
gt; B 2
gt; B 9
gt; B 1
gt; B 5
gt;
gt; can someone help me?! =o)
gt;

全站熱搜
創作者介紹
創作者 software 的頭像
software

software

software 發表在 痞客邦 留言(0) 人氣()