ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trying to give a cell a formula (https://www.excelbanter.com/excel-programming/295138-trying-give-cell-formula.html)

Jan Nordgreen[_2_]

Trying to give a cell a formula
 
I use WinXP and Excel 2000.

In a program I would like set this:

='C:\jans data\jan programming\excel\administracion velarde\[Expensas marzo
2004.xls]PL general'!$M10

as a cell's formula.

The cell links to a cell in another workbook.

I have tried:

Worksheets("Resumen").Cells(4, 3 * i).FormulaR1C1 = "='" & ccarpeta & "[" &
cfilename & "]PL general'!$M10"

where ccarpeta = "C:\jans data\jan programming\excel\administracion
velarde\"
and cfilename = "Expensas marzo 2004.xls"

but I get runtime error '1004'.

It seems it doesn't like the apostrophes ('), which is strange since it does
accept them when I copy and paste the string into the formula bar by hand.

I have tried many other string variations, but with no luck.

When I try: Worksheets("Resumen").Cells(4, 3 * i).FormulaR1C1 = "=" &
ccarpeta,
I get "=I:I:\jans data\jan programming\excel\administracion velarde\". Where
did those Is come from?

Appreciate any help on this!

Regards,

Jan Nordgreen



Jan Nordgreen[_2_]

Problem solved!
 
The trick was to use

Worksheets("Resumen").Cells(4, 3 * i).Formula

instead of

Worksheets("Resumen").Cells(4, 3 * i).FormulaR1C1

Puuuh!



Vasant Nanavati

Trying to give a cell a formula
 
Have you tried using Formula instead of FormulaR1C1?

--

Vasant

"Jan Nordgreen" wrote in message
...
I use WinXP and Excel 2000.

In a program I would like set this:

='C:\jans data\jan programming\excel\administracion velarde\[Expensas

marzo
2004.xls]PL general'!$M10

as a cell's formula.

The cell links to a cell in another workbook.

I have tried:

Worksheets("Resumen").Cells(4, 3 * i).FormulaR1C1 = "='" & ccarpeta & "["

&
cfilename & "]PL general'!$M10"

where ccarpeta = "C:\jans data\jan programming\excel\administracion
velarde\"
and cfilename = "Expensas marzo 2004.xls"

but I get runtime error '1004'.

It seems it doesn't like the apostrophes ('), which is strange since it

does
accept them when I copy and paste the string into the formula bar by hand.

I have tried many other string variations, but with no luck.

When I try: Worksheets("Resumen").Cells(4, 3 * i).FormulaR1C1 = "=" &
ccarpeta,
I get "=I:I:\jans data\jan programming\excel\administracion velarde\".

Where
did those Is come from?

Appreciate any help on this!

Regards,

Jan Nordgreen






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

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