PDA

View Full Version : Solved: import data from another workbook



john3j
06-10-2009, 10:07 AM
Hello all. I am trying to import data without using microsofts wizards because I have so many imports that I need to do that it is starting to strip some of my data out.

I need help writing some code to preserve the integrity and formats of a particular sheet of a particular workbook, and pasting it into cell A1 of the workbook I need the data to appear in.

Lets say I have Workbook1.xls open and need data from another file to be imported onto the sheet "Master" of Workbook1.xls. The data I need pasted is all contents from Workbook2.xls and the sheet is called Sheet1. I would like to just be able to paste this data into the code that runs when the file is opened.

Help would be appreciated. Thanks!:banghead:

john3j
06-10-2009, 10:29 AM
Oh yeah i forgot to add that that Workbook1.xls is stored in C:\Test\Data and Workbook2.xls is stored in C:\Test\Now

mdmackillop
06-10-2009, 10:36 AM
Is the Source workbook already open when the code is run?

john3j
06-10-2009, 05:21 PM
No the source workbook would be closed when the code is ran.