I have a large amount of data in two different worksheets, worksheet 1 and worksheet 2. I am trying to copy all the info from one worksheet to the next, but in a different order.
ie. columns A,B,C in worksheet 1 should be copied into columns B,A,D of worksheet 2.
How can I create a new worksheet and copy certain columns in a given order? The only way I know is to copy it column by column but this takes a very long time.
Thanks!
Yoav
Hi there, the following code should work if I'm understanding the problem correctly.
Sheets("Sheet2").Range("B:B").Value = Sheets("Sheet1").Range("A:A").Value Sheets("Sheet2").Range("A:A").Value = Sheets("Sheet1").Range("B:B").Value Sheets("Sheet2").Range("D:D").Value = Sheets("Sheet1").Range("C:C").Value
If you want to copy formulas and formatting as well,
With Worksheets("Sheet1") .Columns(1).Copy Destination:=Worksheets("Sheet2").Range("B1") .Columns(2).Copy Destination:=Worksheets("Sheet2").Range("A1") .Columns(3).Copy Destination:=Worksheets("Sheet2").Range("D1") End With
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks