View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Zone[_3_] Zone[_3_] is offline
external usenet poster
 
Posts: 373
Default 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