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

Hi,

I would like to copy from Sheet1 Columns B ,A, C in that order

to

Sheet 2 Columns A , B, C

can this be done by array

i.e myarray(B,A,C)

Thanks in advance

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/201005/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Array to copy columns

I found this code but the order of columns remains A,B,C


myarray = "B:B,A:A,C:C"
Worksheets("Sheet1").Range(myarray).Copy Worksheets("Sheet2").Range("A1")


FIRSTROUNDKO wrote:
Hi,

I would like to copy from Sheet1 Columns B ,A, C in that order

to

Sheet 2 Columns A , B, C

can this be done by array

i.e myarray(B,A,C)

Thanks in advance


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/201005/1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Array to copy columns

here is the answer

Sub assignArray()
Dim Arr(3)

Dim X As Long

Arr(1) = "B:B"
Arr(2) = "A:A"
Arr(3) = "C:C"

For X = 1 To 3
' Columns("K:K").Select

Worksheets("Sheet1").Columns(Arr(X)).Copy Worksheets
("Sheet2").Cells(1, X)

Next X

End Sub

FIRSTROUNDKO wrote:
I found this code but the order of columns remains A,B,C

myarray = "B:B,A:A,C:C"
Worksheets("Sheet1").Range(myarray).Copy Worksheets("Sheet2").Range("A1")

Hi,

[quoted text clipped - 9 lines]

Thanks in advance


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/201005/1

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
Variant Array Copy, Array row contains Object Neal Zimm Excel Programming 5 April 13th 10 03:34 PM
Change a Macro - Copy in Columns instead of copy in Rows ytayta555 Excel Programming 7 May 9th 09 06:32 PM
copy one array formula to an array range guedj54 Excel Programming 2 October 29th 06 07:38 PM
How do I copy columns between worksheets if the columns don't matc Miriam Excel Worksheet Functions 10 June 12th 06 04:29 PM
Copy Array pointer rather than entire array R Avery Excel Programming 2 August 24th 04 08:28 PM


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