PC Review


Reply
Thread Tools Rate Thread

How to copy large block of cells but paste into one column

 
 
Craig
Guest
Posts: n/a
 
      15th Aug 2008
Hi

How can I take a large block of data (A1:Y300 which is 24 cols, 300 rows or
7200 cells of data) and paste that data into another sheet but only into one
column (so I get the 7200 data cells all in one column from say B1:B7200.

thank you!!

Craig


 
Reply With Quote
 
 
 
 
Jarek Kujawa
Guest
Posts: n/a
 
      15th Aug 2008
Sub zalatw()
'just qiuck and dirty
'1. select yr range A1:Y300 first
'2. copy it and paste special with TRANSPOSE to another location
'3. Select the range you have pasted
'4. run the macro

Sheets("Sheet2").Columns(2).ClearContents

With ActiveSheet
For i = 0 To Selection.Columns.Count - 1
For j = 1 To Selection.Rows.Count
counter = counter + 1
Sheets("Sheet2").Cells(licznik, 2) = Selection.Cells(counter)
Next j
Next i

'Optional: 5. delete transposed range
'Selection..ClearContents

End With
End Sub


HIH
 
Reply With Quote
 
Jarek Kujawa
Guest
Posts: n/a
 
      15th Aug 2008
oops

this one is better


Sub zalatw()
'just qiuck and dirty
'1. select yr range A1:Y300 first
'2. run the macro
'3. result will be inserted into Sheet2


Sheets("Sheet2").Cells.ClearContents

Selection.Copy
col = Selection.Columns.Count
roww = Selection.Rows.Count

Sheets("Sheet2").Range("D1").PasteSpecial Paste:=xlValues,
Transpose:=True

Sheets("Sheet2").Range(Range("D1"), Range("D1").Offset(col - 1, roww -
1)).Select

With Selection
For i = 0 To Selection.Columns.Count - 1
For j = 1 To Selection.Rows.Count
counter = counter + 1
Sheets("Sheet2").Cells(counter, 2) = Selection.Cells(counter)
Next j
Next i

Sheets("Sheet2").Range(Range("D1"), Range("D1").Offset(col - 1, roww -
1)).ClearContents

Application.CutCopyMode = False

End With
End Sub
 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      15th Aug 2008
Craig

That would 25 cols and 300 rows for 7500 cells.

Sub ToOneColumn()
Dim cntI As Integer
Dim cntJ As Integer
Dim TotalRows As Integer
Dim TotalCols As Integer
With Range("A1:Y300")

TotalRows = .Rows.Count
TotalCols = .Columns.Count

End With

For cntJ = 2 To TotalCols

Cells(1, cntJ).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Cut
Cells((cntJ - 1) * TotalRows + 1, 1).Select
ActiveSheet.Paste

Next cntJ

Cells(1, 1).Select

End Sub


Gord Dibben MS Excel MVP

On Fri, 15 Aug 2008 06:14:01 -0700, Craig <(E-Mail Removed)>
wrote:

>Hi
>
>How can I take a large block of data (A1:Y300 which is 24 cols, 300 rows or
>7200 cells of data) and paste that data into another sheet but only into one
>column (so I get the 7200 data cells all in one column from say B1:B7200.
>
>thank you!!
>
>Craig
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and Paste Formula from ActiveCell to cells in 13 columns priorto the active column sgltaylor Microsoft Excel Programming 1 30th Nov 2009 10:33 AM
Fix the copy and paste feature for cells w large amounts of text =?Utf-8?B?SnVzdEFOaWNlVXNlcg==?= Microsoft Excel Crashes 0 27th Feb 2006 03:07 PM
Copy>Paste Block of Data Murtaza Microsoft Excel Discussion 1 23rd Feb 2005 08:58 PM
a script/macro to copy a block of cells next to specified cells z.entropic Microsoft Excel Programming 8 14th Nov 2003 03:17 PM
Re: Copy/Paste in Excel prints highlighted cells and does not paste Debra Dalgleish Microsoft Excel Misc 0 30th Jul 2003 11:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:24 AM.