ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying columns (https://www.excelbanter.com/excel-programming/406766-copying-columns.html)

Gemz

Copying columns
 
Hi,

By mistake i posted this in the excel worksheet functions post first, please
ignore that. This is the better place to post my problem..

I have the following sample code, this bit of my code creates error. I would
like to copy across the columns in that order please. what is making it go
wrong?

With oldbk.Sheets(2)

..Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP ,AS:AS,AU:AU,AQ:AQ").Copy
Destination:= _
NewbkS2.Range("A1")
End With

thanks.

Nigel[_2_]

Copying columns
 
Try this.....

With oldbk.Sheets(2)
.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy
.Paste Destination:= NewbkS2.Range("A1")
End With

--

Regards,
Nigel




"Gemz" wrote in message
...
Hi,

By mistake i posted this in the excel worksheet functions post first,
please
ignore that. This is the better place to post my problem..

I have the following sample code, this bit of my code creates error. I
would
like to copy across the columns in that order please. what is making it go
wrong?

With oldbk.Sheets(2)

.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy
Destination:= _
NewbkS2.Range("A1")
End With

thanks.



Gemz

Copying columns
 
Hi,

It just highlights this line and reports error:

.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy


thanks.

"Nigel" wrote:

Try this.....

With oldbk.Sheets(2)
.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy
.Paste Destination:= NewbkS2.Range("A1")
End With

--

Regards,
Nigel




"Gemz" wrote in message
...
Hi,

By mistake i posted this in the excel worksheet functions post first,
please
ignore that. This is the better place to post my problem..

I have the following sample code, this bit of my code creates error. I
would
like to copy across the columns in that order please. what is making it go
wrong?

With oldbk.Sheets(2)

.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy
Destination:= _
NewbkS2.Range("A1")
End With

thanks.



Nigel[_2_]

Copying columns
 
Use this to copy the non-contiguous ranges

.Range("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP,AS :AS,AU:AU,AQ:AQ").Copy



--

Regards,
Nigel




"Gemz" wrote in message
...
Hi,

It just highlights this line and reports error:


.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy


thanks.

"Nigel" wrote:

Try this.....

With oldbk.Sheets(2)

.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy
.Paste Destination:= NewbkS2.Range("A1")
End With

--

Regards,
Nigel




"Gemz" wrote in message
...
Hi,

By mistake i posted this in the excel worksheet functions post first,
please
ignore that. This is the better place to post my problem..

I have the following sample code, this bit of my code creates error. I
would
like to copy across the columns in that order please. what is making it
go
wrong?

With oldbk.Sheets(2)

.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy
Destination:= _
NewbkS2.Range("A1")
End With

thanks.




Nigel[_2_]

Copying columns
 
Use

..Range not .Columns

--

Regards,
Nigel




"Gemz" wrote in message
...
Hi,

It just highlights this line and reports error:


.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy


thanks.

"Nigel" wrote:

Try this.....

With oldbk.Sheets(2)

.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy
.Paste Destination:= NewbkS2.Range("A1")
End With

--

Regards,
Nigel




"Gemz" wrote in message
...
Hi,

By mistake i posted this in the excel worksheet functions post first,
please
ignore that. This is the better place to post my problem..

I have the following sample code, this bit of my code creates error. I
would
like to copy across the columns in that order please. what is making it
go
wrong?

With oldbk.Sheets(2)

.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy
Destination:= _
NewbkS2.Range("A1")
End With

thanks.




Gemz

Copying columns
 
Hi,

It copies the range now but the problem is that it copies the stuff and then
puts it in order! i.e. puts the columns in sequential order but i want them
in the order i have put them in the code (no sequential order because thats
how i want to see the info.)

Is there a way around this? or do the columns have to be in order?

thanks.

"Nigel" wrote:

Use this to copy the non-contiguous ranges

.Range("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP,AS :AS,AU:AU,AQ:AQ").Copy



--

Regards,
Nigel




"Gemz" wrote in message
...
Hi,

It just highlights this line and reports error:


.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy


thanks.

"Nigel" wrote:

Try this.....

With oldbk.Sheets(2)

.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy
.Paste Destination:= NewbkS2.Range("A1")
End With

--

Regards,
Nigel




"Gemz" wrote in message
...
Hi,

By mistake i posted this in the excel worksheet functions post first,
please
ignore that. This is the better place to post my problem..

I have the following sample code, this bit of my code creates error. I
would
like to copy across the columns in that order please. what is making it
go
wrong?

With oldbk.Sheets(2)

.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,D:D,AM:AM,AP:AP, AS:AS,AU:AU,AQ:AQ").Copy
Destination:= _
NewbkS2.Range("A1")
End With

thanks.





All times are GMT +1. The time now is 09:35 AM.

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