Workbook formula in a macro

G

Guest

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
 
P

PCLIVE

How about something like this?

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

Regards,
Paul
 
G

Guest

THANKS Pual; that did the trick!!!!!


PCLIVE said:
How about something like this?

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

Regards,
Paul

El Bee said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top