ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select other workbook to select data in a macro. (https://www.excelbanter.com/excel-programming/277522-select-other-workbook-select-data-macro.html)

T Tromp

Select other workbook to select data in a macro.
 
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


Cole[_2_]

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




thomas

Select other workbook to select data in a macro.
 
Thanks very much,
thomas



-----Original 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

.



All times are GMT +1. The time now is 10:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com