PC Review


Reply
Thread Tools Rate Thread

Copying columns

 
 
Gemz
Guest
Posts: n/a
 
      27th Feb 2008
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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
Destination:= _
NewbkS2.Range("A1")
End With

thanks.
 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      27th Feb 2008
Try this.....

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

--

Regards,
Nigel
(E-Mail Removed)



"Gemz" <(E-Mail Removed)> wrote in message
news:1A21844D-16A5-4058-94B2-(E-Mail Removed)...
> 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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
> Destination:= _
> NewbkS2.Range("A1")
> End With
>
> thanks.


 
Reply With Quote
 
Gemz
Guest
Posts: n/a
 
      27th Feb 2008
Hi,

It just highlights this line and reports error:

.Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
> .Paste Destination:= NewbkS2.Range("A1")
> End With
>
> --
>
> Regards,
> Nigel
> (E-Mail Removed)
>
>
>
> "Gemz" <(E-Mail Removed)> wrote in message
> news:1A21844D-16A5-4058-94B2-(E-Mail Removed)...
> > 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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
> > Destination:= _
> > NewbkS2.Range("A1")
> > End With
> >
> > thanks.

>

 
Reply With Quote
 
Nigel
Guest
Posts: n/a
 
      28th Feb 2008
Use this to copy the non-contiguous ranges

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



--

Regards,
Nigel
(E-Mail Removed)



"Gemz" <(E-Mail Removed)> wrote in message
news:C86F2C28-B36A-4085-B8C0-(E-Mail Removed)...
> Hi,
>
> It just highlights this line and reports error:
>
>
> .Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
>> .Paste Destination:= NewbkS2.Range("A1")
>> End With
>>
>> --
>>
>> Regards,
>> Nigel
>> (E-Mail Removed)
>>
>>
>>
>> "Gemz" <(E-Mail Removed)> wrote in message
>> news:1A21844D-16A5-4058-94B2-(E-Mail Removed)...
>> > 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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
>> > Destination:= _
>> > NewbkS2.Range("A1")
>> > End With
>> >
>> > thanks.

>>


 
Reply With Quote
 
Nigel
Guest
Posts: n/a
 
      28th Feb 2008
Use

..Range not .Columns

--

Regards,
Nigel
(E-Mail Removed)



"Gemz" <(E-Mail Removed)> wrote in message
news:C86F2C28-B36A-4085-B8C0-(E-Mail Removed)...
> Hi,
>
> It just highlights this line and reports error:
>
>
> .Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
>> .Paste Destination:= NewbkS2.Range("A1")
>> End With
>>
>> --
>>
>> Regards,
>> Nigel
>> (E-Mail Removed)
>>
>>
>>
>> "Gemz" <(E-Mail Removed)> wrote in message
>> news:1A21844D-16A5-4058-94B2-(E-Mail Removed)...
>> > 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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
>> > Destination:= _
>> > NewbkS2.Range("A1")
>> > End With
>> >
>> > thanks.

>>


 
Reply With Quote
 
Gemz
Guest
Posts: n/a
 
      28th Feb 2008
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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
>
>
>
> --
>
> Regards,
> Nigel
> (E-Mail Removed)
>
>
>
> "Gemz" <(E-Mail Removed)> wrote in message
> news:C86F2C28-B36A-4085-B8C0-(E-Mail Removed)...
> > Hi,
> >
> > It just highlights this line and reports error:
> >
> >
> > .Columns("H:H,T:T,AK:AK,G:G,AJ:AJ,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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
> >> .Paste Destination:= NewbkS2.Range("A1")
> >> End With
> >>
> >> --
> >>
> >> Regards,
> >> Nigel
> >> (E-Mail Removed)
> >>
> >>
> >>
> >> "Gemz" <(E-Mail Removed)> wrote in message
> >> news:1A21844D-16A5-4058-94B2-(E-Mail Removed)...
> >> > 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,AM:AM,AP:AP,AS:AS,AU:AU,AQ:AQ").Copy
> >> > Destination:= _
> >> > NewbkS2.Range("A1")
> >> > End With
> >> >
> >> > thanks.
> >>

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copying columns oldjay Microsoft Excel Misc 3 3rd Dec 2009 11:56 PM
Retrieving Current Row,Columns & copying Format from Row,Columns a Chris Maddogz Microsoft Excel Programming 2 28th May 2009 07:36 AM
Re: Copying Columns Bernie Deitrick Microsoft Excel Programming 0 12th Dec 2006 02:49 PM
Copying several columns =?Utf-8?B?YWNoaWRzZXk=?= Microsoft Excel Programming 2 23rd Dec 2005 05:16 PM
copying columns Deb B. Microsoft Excel Misc 2 28th Nov 2004 07:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:47 AM.