LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default transpose 7 rows/7 columns


Annette wrote:
How can I transpose the above other than selecting each record individually
and paste special with transpose. I have thousands of records and would
like to just run a macro to do the job.

thanks!


I had a spreadsheet that needed to be reformated from rows to columns,
but the order I needed to have it put in was not the order the data was
in. Here is the macro I wrote for this. In the macro I have it
skipping rows in the formating to line up with a template I was using
ex (irow + 10, icol) these can be changed to be in sequence.


Sub FORMAT()
'

Dim irow As Integer
Dim icol As Integer
Dim i As Integer

Selection.Formula = Selection.Value
finalrow = Range("A9999").End(xlUp).Row

'paste the data starting 10 rows from the bottom row
irow = finalrow + 10
icol = 5
For i = 1 To finalrow

'colunm O plus row number the "+ 1" makes it go to the next row
in the loop
'then I tell it where to put the data
Range("O" & i + 1).Copy Destination:=Cells(irow, icol)
Range("A" & i + 1).Copy Destination:=Cells(irow + 1, icol)
Range("M" & i + 1).Copy Destination:=Cells(irow + 2, icol)
Range("N" & i + 1).Copy Destination:=Cells(irow + 3, icol)
Range("H" & i + 1).Copy Destination:=Cells(irow + 10, icol)
Range("E" & i + 1).Copy Destination:=Cells(irow + 11, icol)
Range("K" & i + 1).Copy Destination:=Cells(irow + 13, icol)
Range("Q" & i + 1).Copy Destination:=Cells(irow + 14, icol)
Range("W" & i + 1).Copy Destination:=Cells(irow + 15, icol)
Range("X" & i + 1).Copy Destination:=Cells(irow + 16, icol)
Range("AB" & i + 1).Copy Destination:=Cells(irow + 19, icol)
Range("AC" & i + 1).Copy Destination:=Cells(irow + 20, icol)
Range("AD" & i + 1).Copy Destination:=Cells(irow + 21, icol)
Range("AE" & i + 1).Copy Destination:=Cells(irow + 24, icol)
Range("AF" & i + 1).Copy Destination:=Cells(irow + 25, icol)
Range("AG" & i + 1).Copy Destination:=Cells(irow + 26, icol)
Range("T" & i + 1).Copy Destination:=Cells(irow + 28, icol)
Range("AL" & i + 1).Copy Destination:=Cells(irow + 30, icol)
Range("AM" & i + 1).Copy Destination:=Cells(irow + 31, icol)
Range("AN" & i + 1).Copy Destination:=Cells(irow + 32, icol)

'puts next rows data into a new column and skips a column
icol = icol + 2
Next i
End Sub



 
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
TRANSPOSE ROWS TO COLUMNS excelhel_p Excel Discussion (Misc queries) 4 June 13th 09 08:18 AM
Transpose columns to rows using first columns repeated. hn7155 Excel Worksheet Functions 7 February 12th 09 11:50 PM
How do you transpose rows to columns? msn Excel Discussion (Misc queries) 6 September 1st 07 04:00 AM
transpose 255+ columns into rows? scottwilsonx[_64_] Excel Programming 0 October 25th 04 06:31 PM
Transpose Columns to Rows Rashid Khan Excel Programming 2 June 26th 04 09:49 PM


All times are GMT +1. The time now is 12:42 PM.

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

About Us

"It's about Microsoft Excel"