Featured

    Featured Posts

  • Relation Between Games and Studies
  • Best Screen Protector for Nintendo Switch Available So Far
  • Gamer Problems: Then vs. Now [Comic]
  • Facebook Messenger May Soon Get Reactions, Dislike Button
  • What Happens When You Stop Smoking?

How to write an excel formula into a cell using VBA. [Tutorial]

Using VBA we can write formulas into an excel cell and the formula will start function immediately after the VBA code execution

Below VBA code implement a formula into selected cell:

Sub Insert_formula()

Dim frmla as string
frmla = “=SUM(R2C10:R20C10)”
ActiveCell.FormulaR1C1 = frmla

End sub


Complex formulas also can be implemented in the same manner. Ie convert the formula to a string and assign it to active cell

www.CodeNirvana.in

Copyright © New Techie