PC Review


Reply
Thread Tools Rate Thread

Copying cells between sheets

 
 
=?Utf-8?B?TWFyayBIZXp6?=
Guest
Posts: n/a
 
      27th Oct 2007
Hi!

When I try to write this command in a macro :

sheets("S1").range("A5:E5).copy (sheets("S2").range("A10:E20"))

occurs an Error "Run-time error '1004': Impossible to execute the copy
method in range class". It seems to me the copy command only works well when
target sheet is the current sheet, I think... (It works when I try to copy to
the sheet where the code is executed)
Is there a way to do this? I need to copy the value and the format os the
cells in the range...

Thanks
 
Reply With Quote
 
 
 
 
Roger Whitehead
Guest
Posts: n/a
 
      27th Oct 2007
Sheets("Sheet1").Range("A5:E5").Copy (Sheets("Sheet2").Range("A10:E20"))
or
Sheets(1).Range("A5:E5").Copy (Sheets(2).Range("A10:E20"))

Works for me.
--
HTH
Roger
Shaftesbury (UK)
(Office 2003, Win XP/SP2)



"Mark Hezz" <Mark (E-Mail Removed)> wrote in message
news:43B02A71-70A4-4EB8-8DC8-(E-Mail Removed)...
> Hi!
>
> When I try to write this command in a macro :
>
> sheets("S1").range("A5:E5).copy (sheets("S2").range("A10:E20"))
>
> occurs an Error "Run-time error '1004': Impossible to execute the copy
> method in range class". It seems to me the copy command only works well
> when
> target sheet is the current sheet, I think... (It works when I try to copy
> to
> the sheet where the code is executed)
> Is there a way to do this? I need to copy the value and the format os the
> cells in the range...
>
> Thanks



 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      27th Oct 2007
It probably don't like the missing quote mark and second set of Parentheses.
Try:

Sheets("S1").Range("A5:E5").copy Sheets("S2").Range("A10")

You only need a reference cell in the top left of the range you want to
paste to.

"Mark Hezz" wrote:

> Hi!
>
> When I try to write this command in a macro :
>
> sheets("S1").range("A5:E5).copy (sheets("S2").range("A10:E20"))
>
> occurs an Error "Run-time error '1004': Impossible to execute the copy
> method in range class". It seems to me the copy command only works well when
> target sheet is the current sheet, I think... (It works when I try to copy to
> the sheet where the code is executed)
> Is there a way to do this? I need to copy the value and the format os the
> cells in the range...
>
> Thanks

 
Reply With Quote
 
=?Utf-8?B?TWFyayBIZXp6?=
Guest
Posts: n/a
 
      28th Oct 2007
I found a solution:

sheets("Sheet1").Range("A5:E5").copy Destination:=
sheets("Sheet2").Range("A10")

In this form, it works in my MS Excel 2003.

Thanks All
 
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 cells from one workbook to another with many sheets Memphis Microsoft Excel Programming 2 10th Feb 2009 06:23 PM
Copying cells between sheets in a workbook Rick Microsoft Excel Misc 2 21st Nov 2008 01:55 PM
copying text on sheet 1 to corresponding cells on sheets 2 to 5 Lisa Microsoft Excel New Users 5 1st Oct 2008 06:01 AM
copying the same cells from many sheets t.o. Microsoft Excel Worksheet Functions 3 16th Feb 2006 10:35 PM
Macro copying cells between sheets cbrd Microsoft Excel Programming 6 5th Jan 2006 10:58 PM


Features
 

Advertising
 

Newsgroups
 


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