View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Cole[_2_] Cole[_2_] is offline
external usenet poster
 
Posts: 16
Default Select other workbook to select data in a macro.

Sub test()
Workbooks.Open Filename:= _
"Path & Servant"
'---------
Workbooks("Master").Activate
'copy procedures
ActiveCell.FormulaR1C1 = _
"=[Servant]ColumnName!R2C1:R2C3"
'---------
Workbooks("Servant").Close
End Sub
"T Tromp" wrote in message
...
Hi everyone,

If got a problem.
I want to select data in an other workbook to copy it to
the workbook the macro is placed on. I recorded the macro
and it workes well.
But the problem is that everytime the macro is started
Excel askes where the file(for retrieving data) is. So
everytime i have to browse and point out the file.

This is the VB code:

ActiveCell.FormulaR1C1 = _
"=[theDataFile.xls]ColumnName!R2C1:R2C3"

I tried many things...
like:

ActiveCell.FormulaR1C1 = _
"=[C:\2003\theDataFile.xls]ColumnName!R2C1:R2C3"

but nothing works...!!
please help...

Thomas Tromp