Tuesday, January 5, 2016

Add Formula To Cell With VBA

Insert Formula Into Cell With Macro  Code

           With macro , formulas inserting  are fast especially to multiple cells  .

"Sheets("DATA").Range("I2").AutoFill Destination:=Range("I2:I" & lastrow), Type:=xlFillDefault"

Issues to be considered :
- The extra quotes  must be used .
Example : "= IF(D12<=0,"”valid”,F2*H2)"

- The comma must be used instead of semicolon.
Example : "= IF(F2<=0, H2,F2*H2)" 
When used into page : "= IF(F2<=0; H2;F2*H2)"