Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy data from one Excel workbook to another

Status
Not open for further replies.

HairyHippy

Programmer
Aug 5, 2004
53
GB
Please could someone tell me what is wrong with this code:

Code:
Sheets("Transfer").Range("InputRange").Copy ' From original workbook
Workbooks.Open Filename:="****.xls"         ' Opens destination workbook
Range("CopyStart").Activate                 ' Selects cell in destinatiom workbook where data to be copied to
Selection.PasteSpecial Paste:=xlPasteValues ' Pastes data

Defined name InputRange in original workbook.
**** substituted with real name.
Defined name CopyStart in destination workbook.
 
You want this ?
Sheets("Transfer").Range("InputRange").Copy
Workbooks.Open Filename:="****.xls"
Range("CopyStart").PasteSpecial Paste:=xlPasteValues

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This gives a Run-time error '1004':
Method 'Range' of object'_Worksheet'failed
when trying to paste.
 
Solved!
Workbooks("****.xls").Sheets("Input").Range("CopyStart").PasteSpecial Paste:=xlPasteValues

Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top