![]() |
Copy data from one workbook to another existing workbook
Hi there,
Maybe somebody here can give med a little help on the following problem: I have a "Master"-workbook containing a lot of data, sheets and vba- code. From this master workbook I need to control another EXISTING workbook to which I need 1) to copy two columns in a specified sheet in the master workbook to a specified sheet in the existing workbook and 2) running vba code (macros) in the existing workbook - both from within the maste workbook. Preferable I don't want to see the existing workbook - just letting it have the copied data from the master workbook and execute the macros and when finished closing the workbook again. Is there somebody here who can help me on this task. I am using excel 2003 Thanks in advance. Mads |
Copy data from one workbook to another existing workbook
Mads, This copies columns E and F from Sheet1 of the workbook with the code
in it to columns E and F of Sheet1 of another workbook. Copy the code below and paste in a standard module of the workbook you want to copy from. Change the path of the workbook to open as needed. You do not say what columns you want to copy, so I just used E and F. Change as needed. You also did not say whether you wanted to insert or paste the columns. Note also that the workbook to copy to cannot already be open. HTH, James Sub SaveColsToExisting() ThisWorkbook.Worksheets("Sheet1").Activate Columns("e:f").Copy Application.ScreenUpdating = False 'change path below to desired path Workbooks.Open "c:\Test\Existing Workbook.xls" Worksheets("Sheet1").Activate [e1].Select ActiveSheet.Paste [e1].Select ActiveWorkbook.Close savechanges:=True Application.CutCopyMode = False Application.ScreenUpdating = True End Sub "Mads" wrote in message ups.com... Hi there, Maybe somebody here can give med a little help on the following problem: I have a "Master"-workbook containing a lot of data, sheets and vba- code. From this master workbook I need to control another EXISTING workbook to which I need 1) to copy two columns in a specified sheet in the master workbook to a specified sheet in the existing workbook and 2) running vba code (macros) in the existing workbook - both from within the maste workbook. Preferable I don't want to see the existing workbook - just letting it have the copied data from the master workbook and execute the macros and when finished closing the workbook again. Is there somebody here who can help me on this task. I am using excel 2003 Thanks in advance. Mads |
Copy data from one workbook to another existing workbook
Perfect - it works as for the copying of data from one worksheet to
another existing worksheet. Thanks Zone. Then - does anybody here have any idea on how to execute a macro in another workbook (without activating it) from a "master" workbook?? Mads |
Copy data from one workbook to another existing workbook
The other workbook doesn't have to be active, but it does have to be open.
James Application.Run "MyWorkbook.xls!MySub" "Mads" wrote in message oups.com... Perfect - it works as for the copying of data from one worksheet to another existing worksheet. Thanks Zone. Then - does anybody here have any idea on how to execute a macro in another workbook (without activating it) from a "master" workbook?? Mads |
All times are GMT +1. The time now is 10:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com