PC Review


Reply
Thread Tools Rate Thread

Copy in VBA problem

 
 
Ian
Guest
Posts: n/a
 
      29th Oct 2007
I'm trying to automatically insert some data copied from an Access table
into an Excel spreadsheet into another Excel spreadsheet.

Both sheets are open and referred to as objExcel & objExcel1.

I get "Copy method of Range class failed" with the following line.

objExcel1.range("A1:H1").copy objExcel.range("A5")

Any ideas?

Ian


 
Reply With Quote
 
 
 
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      30th Oct 2007
I'm not an Excel MVP, but offhand it appears as if your 2 ranges do not
match in size. You may want to ask this in an Excel newsgroup as well.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Ian" <(E-Mail Removed)> wrote in message
news:%TpVi.5111$(E-Mail Removed)...
> I'm trying to automatically insert some data copied from an Access table
> into an Excel spreadsheet into another Excel spreadsheet.
>
> Both sheets are open and referred to as objExcel & objExcel1.
>
> I get "Copy method of Range class failed" with the following line.
>
> objExcel1.range("A1:H1").copy objExcel.range("A5")
>
> Any ideas?
>
> Ian
>



 
Reply With Quote
 
Ian
Guest
Posts: n/a
 
      30th Oct 2007
I'll try adjusting the destination size later on, but in Excel, unless there
are merged cells, you only need to state the top. left cell.

Thanks for the suggestion.

Ian

"Arvin Meyer [MVP]" <(E-Mail Removed)> wrote in message
news:%23amWj$(E-Mail Removed)...
> I'm not an Excel MVP, but offhand it appears as if your 2 ranges do not
> match in size. You may want to ask this in an Excel newsgroup as well.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
> "Ian" <(E-Mail Removed)> wrote in message
> news:%TpVi.5111$(E-Mail Removed)...
>> I'm trying to automatically insert some data copied from an Access table
>> into an Excel spreadsheet into another Excel spreadsheet.
>>
>> Both sheets are open and referred to as objExcel & objExcel1.
>>
>> I get "Copy method of Range class failed" with the following line.
>>
>> objExcel1.range("A1:H1").copy objExcel.range("A5")
>>
>> Any ideas?
>>
>> Ian
>>

>
>



 
Reply With Quote
 
Ian
Guest
Posts: n/a
 
      30th Oct 2007
Hi Arvin

I'm afraid it din't work, but I've found another method that works.

Ian

"Arvin Meyer [MVP]" <(E-Mail Removed)> wrote in message
news:%23amWj$(E-Mail Removed)...
> I'm not an Excel MVP, but offhand it appears as if your 2 ranges do not
> match in size. You may want to ask this in an Excel newsgroup as well.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
> "Ian" <(E-Mail Removed)> wrote in message
> news:%TpVi.5111$(E-Mail Removed)...
>> I'm trying to automatically insert some data copied from an Access table
>> into an Excel spreadsheet into another Excel spreadsheet.
>>
>> Both sheets are open and referred to as objExcel & objExcel1.
>>
>> I get "Copy method of Range class failed" with the following line.
>>
>> objExcel1.range("A1:H1").copy objExcel.range("A5")
>>
>> Any ideas?
>>
>> Ian
>>

>
>



 
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
Copy local users and groups, copy shares with security, copy homeuser folders usenet@sphere10.com Microsoft Windows 2000 Active Directory 1 17th Feb 2009 01:31 PM
Copy local users and groups, copy shares with security, copy homeuser folders usenet@sphere10.com Windows Vista General Discussion 2 17th Feb 2009 01:31 PM
A visual basic value copy BUG?? - accounting format has copy problem!! yunyanl@gmail.com Microsoft Excel Programming 3 20th Jun 2006 04:42 PM
Copy problem again. Peter Microsoft Excel Programming 4 6th Nov 2004 12:20 PM
my 2 hd's started getting bad sectors,got a new one. now i just want to copy over the whole HD to the new one so i wont have to reinstall everything but the problem is some files are being used. how can i bypass this problem and copy EVERYTHING ? =?Utf-8?B?RWxhc3RpY21hbg==?= Windows XP General 1 28th Mar 2004 02:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:02 PM.