ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy and paste columns (https://www.excelbanter.com/excel-programming/359234-copy-paste-columns.html)

EstherJ

Copy and paste columns
 
I am trying to copy and paste columns of data from one sheet into another. I
have named the ranges CUST, PART, REG etc. but I cannot get the macro to
paste all the columns.

Thank you,

Esther

Ivan Raiminius

Copy and paste columns
 
Hi Esther,

what exactly is the problem? Can't you copy some of the named ranges at
all or some of the columns in named ranges cannot be copied?

Please try to be more specific.

Regards,

Ivan


EstherJ

Copy and paste columns
 
I does now work but although I specified below the order I wanted them
copied, when it pastes into the new sheet it is in the original order. Is
there a way around this?

Thanks,

Esther


Worksheets(1).Range("CUST,REG,CUSTACC,RSM,MKTSEG,T ECH,CUSTPN,CMACPN,ATT,PLAT,SEPOOHQTY,SEPUNITPRICE" ).Copy
Sheets("Sheet2").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

"Ivan Raiminius" wrote:

Hi Esther,

what exactly is the problem? Can't you copy some of the named ranges at
all or some of the columns in named ranges cannot be copied?

Please try to be more specific.

Regards,

Ivan



Ivan Raiminius

Copy and paste columns
 
Hi Esther,

if you want to change order of columns, you have to rearange them after
copying, or to copy them one by one in desired order.

Regards,

Ivan


Tom Ogilvy

Copy and paste columns
 
Another way to do it would be to use an advanced filter. This assumes you
worksheet is similar to a database and the first row has "column/field
headers"

You would write the headers in the order you want in the destination sheet
(with code of course), then use the advanced filter to populate them.

Post back if that sounds like something that would fit your needs.

--
Regards,
Tom Ogilvy


"Ivan Raiminius" wrote:

Hi Esther,

if you want to change order of columns, you have to rearange them after
copying, or to copy them one by one in desired order.

Regards,

Ivan




All times are GMT +1. The time now is 12:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com