Wednesday, March 13, 2013

Insert Formula in excel cell using VBA

Below syntax is used to insert formula into excel sheet

ActiveSheet.Cells(f, 6).Formula = "=DATE(YEAR(B2),MONTH(B2),DAY(B2))"

Range(c2).formula = "=A1 + B1"

for i = 1 to 10 step 1
           Range(c2).formula =  "=A"& i & "+B" & i
next
 

No comments: