merge data macro
Hi,
You could put something like the following in a third workbook or an add-in.
When run, it prompts the user for the location of the source & target
workbooks, opens them so you can do stuff, and then closes them. Without
knowing what your sheets contain I can't help with the merge...
sub test()
dim xwb as workbbook
dim wb as workbook
Dim fd As FileDialog
'Open source workbook
Set fd = Application.FileDialog(msoFileDialogFilePicker)
If fd.Show = False Then Exit Sub
sPath = fd.SelectedItems(1)
Set xwb = Workbooks.Open(sPath)
'Open target workbook
Set fd = Application.FileDialog(msoFileDialogFilePicker)
If fd.Show = False Then Exit Sub
sPath = fd.SelectedItems(1)
Set wb = Workbooks.Open(sPath)
'Do what you want with the workbooks
'Close workbooks
xwb.close
wb.close
end sub
Sam
"Julie" wrote:
I am looking for a macro to merge data from a source workbook to a
destination workbook with a common key. However, the macro cannot reside in
either the source or the destination workbooks. The destination workbook is
received from an external source (format remains the same, only the data
changes) and the source workbook is exported from MSAccess which replaces the
previous file each time.
Hope someone can help.
|