Wednesday, 24 January 2007

Excel Formula Activecell.FormulaR1C1

What a mission, I was trying to insert a formula into a cell via a Macro with variables in it but got stuck with TExt values or #NUM values the whole time. I tried about anything

  • (variable,
  • ("variable",
  • (" & variable & ",
  • (''' & variable & "",
  • (""" & variable & """,

but with no luck,
I then even created a string = "formula with variables" and used ActiveCell.FormulaR1C1 = string but it did not work either just to realize :

Use ActiveCell.Formula =

and not

ActiveCell.FormulaR1C1

and that solved my variable within a formula in Excel VBA Script ;-)

No comments:

Post a Comment