ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Workbook formula in a macro (https://www.excelbanter.com/excel-worksheet-functions/118751-workbook-formula-macro.html)

El Bee

Workbook formula in a macro
 
I have a macro that opens another spreadsheet (spreadsheet B).
This second spreadsheet is named: "Projections 2006".

I create a var called WB2 which contains the name of this spreadsheet:
WB2 = ActiveWorkbook.Name

The macro then does some sorting and formatting on this spreadsheet.
I now want to add a formula in Spreadsheet A that points to a specific cell
in spreadsheet B (wb2)
I've tried several variations of the formula below and nothing works.

ActiveCell.FormulaR1C1 = "='[wb2]projections'!R3C5"

Can someone point me in the right direction?

Thanks,
El Bee

PCLIVE

Workbook formula in a macro
 
How about something like this?

Activecell.value = workbooks(wb2).sheets("projections").Range("E3").f ormula

Regards,
Paul

"El Bee" wrote in message
...
I have a macro that opens another spreadsheet (spreadsheet B).
This second spreadsheet is named: "Projections 2006".

I create a var called WB2 which contains the name of this spreadsheet:
WB2 = ActiveWorkbook.Name

The macro then does some sorting and formatting on this spreadsheet.
I now want to add a formula in Spreadsheet A that points to a specific
cell
in spreadsheet B (wb2)
I've tried several variations of the formula below and nothing works.

ActiveCell.FormulaR1C1 = "='[wb2]projections'!R3C5"

Can someone point me in the right direction?

Thanks,
El Bee




El Bee

Workbook formula in a macro
 
THANKS Pual; that did the trick!!!!!


"PCLIVE" wrote:

How about something like this?

Activecell.value = workbooks(wb2).sheets("projections").Range("E3").f ormula

Regards,
Paul

"El Bee" wrote in message
...
I have a macro that opens another spreadsheet (spreadsheet B).
This second spreadsheet is named: "Projections 2006".

I create a var called WB2 which contains the name of this spreadsheet:
WB2 = ActiveWorkbook.Name

The macro then does some sorting and formatting on this spreadsheet.
I now want to add a formula in Spreadsheet A that points to a specific
cell
in spreadsheet B (wb2)
I've tried several variations of the formula below and nothing works.

ActiveCell.FormulaR1C1 = "='[wb2]projections'!R3C5"

Can someone point me in the right direction?

Thanks,
El Bee






All times are GMT +1. The time now is 10:54 AM.

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