Reputation: 53
I have troubles with writing formula in Excel VBA.
Sub Macro()
valueA1 = Range("A1").Value
Range("C1").Formula = "=RC[-1]*" & valueA1
End Sub
At the end I want formula in cell C1 to be written as =B1*0,5
, if value in B1 is 0,5
.
Thaks for the help!
Upvotes: 0
Views: 1358
Reputation: 23974
Excel doesn't like foreign languages. You will need to use FormulaR1C1Local
:
Range("C1").FormulaR1C1Local = "=RC[-1]+" & valueA1
or maybe
Range("C1").FormulaR1C1Local = "=RC[-1]*" & valueA1
if you are trying to multiply B1*A1. (Your question says multiply, your code says add.)
That should cause it to accept "0,5"
as a valid number.
Upvotes: 1