Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Transpose" Macro.

Dear All,

I am a new user of VBA macros in Excel, and I want to do a very basi
operation.

I have data in several thousands of rows (each column corresponds to
year, I have about a dozen columns).
I want to order this data (copy/transpose) in a single column. I kno
how to do that by running the recorder
for one single copy/transpose operation, and I could do that by copyin
the commands below 2000 times,

Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("T2").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone
SkipBlanks:=False _
, transpose:=True
and so on....

but I assume I can do that with a single "loop" instruction. Can an
one tell me how I could do that?

Best,

Lucio

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default "Transpose" Macro.

Assuming you have 2000 rows of data, and you want to end up with that
data in T2:T24001 as you indicated

Sub c()
Dim rngIn As Range, rngOut As Range, i As Long
Set rngIn = Range("A2:L2000")
Set rngOut = Range("T2")
For i = 1 To rngIn.Rows.Count
rngIn.Rows(i).Copy
rngOut(1 + (rngIn.Columns.Count) * (i - 1)).PasteSpecial _
Transpose:=True
Next
Application.CutCopyMode = False
End Sub

Alan Beban

lvdesouza < wrote:
Dear All,

I am a new user of VBA macros in Excel, and I want to do a very basic
operation.

I have data in several thousands of rows (each column corresponds to a
year, I have about a dozen columns).
I want to order this data (copy/transpose) in a single column. I know
how to do that by running the recorder
for one single copy/transpose operation, and I could do that by copying
the commands below 2000 times,

Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("T2").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
, transpose:=True
and so on....

but I assume I can do that with a single "loop" instruction. Can any
one tell me how I could do that?

Best,

Lucio.


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Transpose" Macro.

Dear Don,

Thanks for your reply. As I indicated in my message, I want to put the
in a single column (i.e., on the top of each other). As the last time
checked Excel had roughly 65.000 rows, this kind of seems feasible t
me.

Lucio.


Don Lloyd wrote:
*Hi Lucio,

You Paste Transpose from Row 2 to Column T.
Where do propose to put the other thousands of rows ?
You only have 256 columns on a sheet.

Regards,
Don

"lvdesouza " wrote i
message
...
Dear All,

I am a new user of VBA macros in Excel, and I want to do a ver

basic
operation.

I have data in several thousands of rows (each column correspond

to a
year, I have about a dozen columns).
I want to order this data (copy/transpose) in a single column.

know
how to do that by running the recorder
for one single copy/transpose operation, and I could do that b

copying
the commands below 2000 times,

Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("T2").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
, transpose:=True
and so on....

but I assume I can do that with a single "loop" instruction. Ca

any
one tell me how I could do that?

Best,

Lucio.


---
Message posted from http://www.ExcelForum.com/


--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Transpose" Macro.

Dear Alan,

Thanks for your reply, I will try it right now.

Best,

Lucio.
Alan Beban wrote:
*Assuming you have 2000 rows of data, and you want to end up wit
that
data in T2:T24001 as you indicated

Sub c()
Dim rngIn As Range, rngOut As Range, i As Long
Set rngIn = Range("A2:L2000")
Set rngOut = Range("T2")
For i = 1 To rngIn.Rows.Count
rngIn.Rows(i).Copy
rngOut(1 + (rngIn.Columns.Count) * (i - 1)).PasteSpecial _
Transpose:=True
Next
Application.CutCopyMode = False
End Sub

Alan Beban

lvdesouza < wrote:
Dear All,

I am a new user of VBA macros in Excel, and I want to do a ver

basic
operation.

I have data in several thousands of rows (each column correspond

to a
year, I have about a dozen columns).
I want to order this data (copy/transpose) in a single column.

know
how to do that by running the recorder
for one single copy/transpose operation, and I could do that b

copying
the commands below 2000 times,

Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("T2").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
, transpose:=True
and so on....

but I assume I can do that with a single "loop" instruction. Ca

any
one tell me how I could do that?

Best,

Lucio.


---
Message posted from http://www.ExcelForum.com/


--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default "Transpose" Macro.

Hi Lucio,

You Paste Transpose from Row 2 to Column T.
Where do propose to put the other thousands of rows ?
You only have 256 columns on a sheet.

Regards,
Don

"lvdesouza " wrote in message
...
Dear All,

I am a new user of VBA macros in Excel, and I want to do a very basic
operation.

I have data in several thousands of rows (each column corresponds to a
year, I have about a dozen columns).
I want to order this data (copy/transpose) in a single column. I know
how to do that by running the recorder
for one single copy/transpose operation, and I could do that by copying
the commands below 2000 times,

Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("T2").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
, transpose:=True
and so on....

but I assume I can do that with a single "loop" instruction. Can any
one tell me how I could do that?

Best,

Lucio.


---
Message posted from http://www.ExcelForum.com/



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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How do I "paste link", and "transpose" at the same time? Zhi Sheng Excel Discussion (Misc queries) 3 August 5th 08 02:40 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 09:14 AM.

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"