ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Copying across columns (https://www.excelbanter.com/excel-worksheet-functions/178081-copying-across-columns.html)

Gemz

Copying across columns
 
Hi,

I have the following sample code which keeps creating an error, please can
you tell me whats wrong? the columns to copy need to be in that order.

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.

Don Guillett

Copying across columns
 


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Gemz" wrote in message
...
Hi,

I have the following sample code which keeps creating an error, please can
you tell me whats wrong? the columns to copy need to be in that order.

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.



Don Guillett

Copying across columns
 
Finger too fast.Try this idea

Sub copycols()
Range("h1,t1,ak1").EntireColumn.Copy cells(2,1)
Range("g1,aj1").EntireColumn.Copy cells(2,4)
'etc
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Gemz" wrote in message
...
Hi,

I have the following sample code which keeps creating an error, please can
you tell me whats wrong? the columns to copy need to be in that order.

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 02:48 PM.

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