The folllowing VBA code doesn't work: (I assume that addedvalue is rational numer)
Dim addedvalue As Double
addedvalue = 1
ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+" & CStr(addedvalue)
However this one works fine:
ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+" & 1
Unfortunately, I must have addedvalue as a variable.
I was trying also
ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+" & addedvalue
but it also doesn't work.
The error message I gor is: enter image description here
UPDATE The problem is why this doesn't work:
Sub added()
Dim rational As Double
rational = 1.1
ActiveCell.FormulaR1C1 = ActiveCell.FormulaR1C1 & "+" & rational
End Sub
For everyone, using comma as a decimal separator, the VBEditor has a small "feature". Long story short, try the following:
This is my custom function, that I use for cases like this (and they are quite a lot):
Tried it and works just fine:
If you are not using a US-EN version of Excel, you have two easy options:
The answer by Vityata gives an example of how to use option 1.
Option 2 would look something like: