Thread: Formula problem
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Matyas Kormendy Matyas Kormendy is offline
external usenet poster
 
Posts: 2
Default Formula problem

Hi!

The original line in code wasn't broken, so the solution
is what Frank Kabel wrote.
Thanks anyway!

Regards, Matyas

-----Original Message-----
You can't put line continuation characters within a

string

Worksheets("Radni nalog").Range("AC19").Formula = _
"=PRODUCT('Ostvareni indirektni troskovi'!" &

_
"T12;'Radni nalog'!AC13)/" & _
"OFFSET('Ostvareni direktni troskovi'!" & _
"P10;+'Osnovni podaci'!R8;0;1;1)"

Should work.

--

Regards,
Tom Ogilvy

"Matyas" wrote in

message
...
In a Microsoft Visual Basic for Applications macro

(Excel
2000), when I attempt to put a formula in a cell
in some cases I receive the following run-time error:

Run-time error '1004':
Application-defined or object-defined error

For example, the first 3 statements bellow works fine,
but the 4TH doesn't:
.
.
.
Worksheets("Radni nalog").Range("F3").Formula
= "='Planska kalkulacija'!F3:G3"
Worksheets("Radni nalog").Range("H6:Q6").Formula
= "='Planska kalkulacija'!H6:Q6"
Worksheets("Radni nalog").Range("AF6").Formula
= "='Planska kalkulacija'!Y6"
'The next statement doesn't works:
Worksheets("Radni nalog").Range("AC19").Formula = _
"=PRODUCT('Ostvareni indirektni troskovi'!
T12;'Radni nalog'!AC13)/ _
OFFSET('Ostvareni direktni troskovi'!
P10;+'Osnovni podaci'!R8;0;1;1)"
.
.
.
If I remove the equal sign from the beginning of the
formula,
the formula will be placed to the cell!(Of course, it

has
no sense without =)

Could anyone help me?



.