From: FIRSTROUNDKO via OfficeKB.com on 7 May 2010 07:13 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.aspx/excel-programming/201005/1
From: FIRSTROUNDKO via OfficeKB.com on 7 May 2010 08:28 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.aspx/excel-programming/201005/1
From: FIRSTROUNDKO via OfficeKB.com on 7 May 2010 10:33 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.aspx/excel-programming/201005/1
From: Don Guillett on 7 May 2010 11:24 Another way Sub CopycolumnsCustom() With Sheets("Sheet14") Sheets("sheet9").Columns("A:C").Copy .Range("a1") Application.CutCopyMode = False .Columns("B").Cut .Columns("A").Insert , Shift:=xlToRight End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett(a)gmail.com "FIRSTROUNDKO via OfficeKB.com" <u15639(a)uwe> wrote in message news:a7a6c6f60e4a6(a)uwe... > 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.aspx/excel-programming/201005/1 >
|
Pages: 1 Prev: ANSWERED Next: Dynamically Create and ID OptionButtons, then insert Row; Loop |