Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying cells between sheets
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying cells between sheets
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 wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying cells between sheets
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copying cells between sheets
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copying cells between sheets in a workbook | Excel Discussion (Misc queries) | |||
copying text on sheet 1 to corresponding cells on sheets 2 to 5 | New Users to Excel | |||
HAVE ONE REPORT SHEET WITH LINKS FROM VARIOUS SHEETS. ON COPYING THIS LINKED SHEET FOR EXPORTING IT TO THE OFFICE GET ERRORS IN CELLS. HOW TO RESOLVE THIS? | Excel Programming | |||
copying the same cells from many sheets | Excel Worksheet Functions | |||
Macro copying cells between sheets | Excel Programming |