Change Formula to macro


Posted by Andonny on January 05, 2001 2:11 AM

Hi,
I would like to change this code below from =C1-B1 to =DATE(IF(LEFT(A1,1) ="1",2000+MID(A1,2,2),LEFT(A1,2)),1,1)+(RIGHT(A1,3)-1) :

Sub InsertDFormula()
Range("B1", Range("B65536").End(xlUp)).Offset(0, 2).FormulaR1C1 = "=rc[-1]-rc[-2]"
End Sub

Thanks for your help in advance
Andonny



Posted by Celia on January 05, 2001 2:37 AM


The best way is to start the macro recorder and enter the formula in a cell. The recorded macro will give you the correct synyax for the formula.
Celia