ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with formula in VBA (https://www.excelbanter.com/excel-programming/282662-problem-formula-vba.html)

nagar

Problem with formula in VBA
 

Hi,

I get an error when I put this line of code in VBA (I'm using th
Italian version of Excel).

I noticed that when I put more complex formulas I got errors.

Dim mystring as string
Dim firstfreepos as integer

mystring = "=SE(C" & firstFreePos & ";C" & firstFreePos & "-B"
firstFreePos & ";OGGI()-B" & firstFreePos & ") "
Range("D" & firstFreePos).Formula = (mystring)

I got no errors removing the '=' symbol from the beginning of th
formula.
If anyone can help me, it would really be appreciated.
Thanks.
Andre

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


Stephen Bullen[_2_]

Problem with formula in VBA
 
Hi nagar

Excel VBA is US-centric, so you need to either use the US-English version of
the formulas (including US separators), or use .FormulaLocal instead of
..Formula (which will only then work with Italian settings).

Regards

Stephen Bullen

"nagar" wrote in message
...

Hi,

I get an error when I put this line of code in VBA (I'm using the
Italian version of Excel).

I noticed that when I put more complex formulas I got errors.

Dim mystring as string
Dim firstfreepos as integer

mystring = "=SE(C" & firstFreePos & ";C" & firstFreePos & "-B" &
firstFreePos & ";OGGI()-B" & firstFreePos & ") "
Range("D" & firstFreePos).Formula = (mystring)

I got no errors removing the '=' symbol from the beginning of the
formula.
If anyone can help me, it would really be appreciated.
Thanks.
Andrea


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 01:25 PM.

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