View Full Version : Merging Data
chinanomad
03-01-2011, 12:59 AM
I attached an example for reference.
In this example I have 3 files.
Master File = EF Example
data file 1 = glass
data file 2 - plastic
The master file has 3 spreadsheets.
planning
glass
plastic
Is there are why for Excel/Access can use the data in (data files) upload them into the master file so the information from glass is moved to glass and the information from plastic is moved to plastic?
IBihy
03-01-2011, 10:09 AM
Hello Chinanaomad,
Yes, you can. But before going about it, please structure your requirements clearly for yourself. You say "...Excel/Access...". What is that supposed to mean exactly? Are the files "glass" and "plastic" in Excel or in Access?
Generally you would do something like this:
Dim wbMaster As Workbook
Dim wbGlass As Workbook
Dim wbPlastic As Workbook
Dim wsMaster As Worksheet
Dim wsGlass As Worksheet
Dim wsPlastic As Worksheet
Set wbMaster = ThisWorkbook
Set wsMaster = wbMaster.Worksheets("Master")
Set wsGlass = wbMaster.Worksheets("Glass")
Set wsPlastic = wbMaster.Worksheets("Plastic")
Workbooks.Open("<full path>\glass.xls")
Workbooks(2).Activate
Set wbGlass = ActiveWorkbook
Workbooks.Open("<full path>\plastic.xls")
Workbooks(3).Activate
Set wbPlastic = ActiveWorkbook
' now return to master, not really elegant, but usable
wbMaster.Activate
...
Please note, the above is only a general hint. The code of copying the cell contents is not there.
Regards,
Isabella
chinanomad
03-03-2011, 11:04 PM
Thank you. When using VBA: in multiple workbooks, does the code had to be loaded into both or just the master workbook?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.