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!
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.