Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default macro for transposing data

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:
A 3 4 7
B 5 2 9 1 5

I need it to look like this:
A 3
A 4
A 7
B 5
B 2
B 9
B 1
B 5

can someone help me?! =o)

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme
 
Posts: n/a
Default macro for transposing data

This works for me with the sample data

Sub trans()
Set rng = Range("A1:F2") 'The input range: adjust as needed
Sheets("Sheet2").Select 'delete this line is transposing
to same sheet
Range("A10").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

wrote in message
ups.com...
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:
A 3 4 7
B 5 2 9 1 5

I need it to look like this:
A 3
A 4
A 7
B 5
B 2
B 9
B 1
B 5

can someone help me?! =o)



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to sort data in worksheet by specific date joey Excel Discussion (Misc queries) 0 November 14th 05 07:59 PM
Creating a macro to save only partial data Jparsons Excel Discussion (Misc queries) 0 September 24th 05 10:50 AM
Macro that will add data from multiple workbooks to the 1st open r jbsand1001 Excel Discussion (Misc queries) 0 April 23rd 05 07:52 PM
Extract specific data into its own workbook via macro? Adrian B Excel Discussion (Misc queries) 2 February 24th 05 06:09 AM
Daily Macro to Download Data, Order and paste in order Iarla Excel Worksheet Functions 1 November 17th 04 01:59 PM


All times are GMT +1. The time now is 01:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"