Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default copy multiple columns

Can somebody help me, I need to copy values from multiple columns to one
row, for example:

A1,B1,C1,D1
A2,B2,C2,D2
A3,B3,C3,D3

in

A1,B1,C1,D1,A2,B2,C2,D2,A3,B3,C3,D3.

I don't know witch object (Range or Cell) and its parameters to us.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy multiple columns


Here's a code that would work for you,

Remember that you only have 256 columns though you can ony do this fo
64 rows


Code
-------------------
Sub CutPasteToRowA()
Range("A2").Select
Do Until ActiveCell = ""
ActiveCell.Range("A1:D1").Cut Destination:=Range("A1").End(xlToRight).Offset(0, 1).Range("A1")
ActiveCell.Offset(1, 0).Select
Loop
Range("A1").Select
End Sub

-------------------

--
Paul Morga
-----------------------------------------------------------------------
Paul Morgan's Profile: http://www.officehelp.in/member.php?userid=519
View this thread: http://www.officehelp.in/showthread.php?t=136929

Posted from - http://www.officehelp.i

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default copy multiple columns

Cell is index with a row number and a column number like Cells(1,3) which is
row 1 and column C.

Range has multiple for mats. the simple one is

Range("A3") where A3 is a character string. Range can also be made of cells
such as

Range(Cells(1,3),Cells(2,6))

I usually prefer to use a range with an offset such as

Range("A3:D3").offset(rowoffset:=2,columnoffset:=3 )

this format is nice because you can put it in a for loop and ichange the
rows or columns

for i = 1 to 10

Range("A3:D3").offset(rowoffset:=i,columnoffset:=3 )

Next i


Example 1
MyColoffset = 0
For RowCount = 1 To 3


Range("A1:D4").Offset(rowoffset:=RowCount - 1, columnoffset:=0).Copy _
Destination:=Range("A10"). _
Offset(rowoffset:=0, columnoffset:=4 * (RowCount - 1))


Next RowCount
newrange
next rowcount

Example 2

Set oldrange = Range("A1:D4")
Set newrange = Range("A10")
MyColoffset = 0
For RowCount = 1 To 3

oldrange.Offset(rowoffset:=RowCount - 1, columnoffset:=0).Copy _
Destination:=newrange. _
Offset(rowoffset:=0, columnoffset:=4 * (RowCount - 1))

Next RowCount
"Milax" wrote:

Can somebody help me, I need to copy values from multiple columns to one
row, for example:

A1,B1,C1,D1
A2,B2,C2,D2
A3,B3,C3,D3

in

A1,B1,C1,D1,A2,B2,C2,D2,A3,B3,C3,D3.

I don't know witch object (Range or Cell) and its parameters to us.

Thanks!

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
Help to copy multiple columns to a spreadsheet Retread Excel Worksheet Functions 3 June 12th 08 08:29 PM
Copy the same 2 columns from multiple spreadsheets into one new sh Tas Excel Discussion (Misc queries) 0 December 7th 07 12:04 AM
VBA: Copy from columns on multiple worksheets ddate Excel Programming 0 October 27th 04 12:45 AM
Copy the row multiple times while translating the columns Anamik Excel Programming 2 October 26th 04 05:42 PM
Copy/Paste Function for multiple columns AF_INstructor Excel Programming 1 January 6th 04 09:10 AM


All times are GMT +1. The time now is 09:24 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"