ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula error when created via VBA (https://www.excelbanter.com/excel-programming/447947-formula-error-when-created-via-vba.html)

Max Woland

Formula error when created via VBA
 
This is my issue: I was finally able to input a formula into sheets by the range.formula property. The formula is properly displayed (it's a very easy "=SUM(C1;C10)") but returns an #ERROR. When I parse it through the Error's information menu, it says that it's SUM to cause the problem. identical formula works fine when input manually, but the bauty is that if I copy from the sheet's correct formula and paste it into tne range.formula property is stops working once pasted! :o(

the real cell content is as follows (soz, it's in italian)

=somma(C1:C9)

I couldn't find any trailing hidden characters.
Any idea?
Thank you for your time!

Claus Busch

Formula error when created via VBA
 
Ciao Max,

Am Mon, 7 Jan 2013 16:39:54 +0000 schrieb Max Woland:

This is my issue: I was finally able to input a formula into sheets by
the range.formula property. The formula is properly displayed (it's a
very easy "=SUM(C1;C10)") but returns an #ERROR.


VBA speaks english. If you want to sum C1:C10 then
[A1].Formula = "=Sum(C1:C10)"
IF you want to sum C1 and C10 then
[A2].Formula = "=Sum(C1,C10)"
If you want the italian formula then:
[A1].FormulaLocal = "=Somma(C1:C10)"


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

witek

Formula error when created via VBA
 
Max Woland wrote:
This is my issue: I was finally able to input a formula into sheets by
the range.formula property. The formula is properly displayed (it's a
very easy "=SUM(C1;C10)")


; or : ?


but returns an #ERROR. When I parse it through
the Error's information menu, it says that it's SUM to cause the
problem. identical formula works fine when input manually, but the bauty
is that if I copy from the sheet's correct formula and paste it into tne
range.formula property is stops working once pasted! :o(

the real cell content is as follows (soz, it's in italian)

=somma(C1:C9)

I couldn't find any trailing hidden characters.
Any idea?
Thank you for your time!





type your formula manually, select that cell and in vbe in immediate
window display it.

? activecell.formula

then compare with formula in your code.


remember that .formula = .... accepts formulas in English only.




All times are GMT +1. The time now is 12:14 PM.

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