Hi, i have the following snippet which i am using to insert formulas into a worksheet. the first formula gets inserted where there are blank cells in the specified column, the second is supposed to overwrite whatever already exists in the specified column. the second one isn't working. Have i got the range specified correctly?
Code:
With Worksheets("Forward Plan")
x = .Range("b36").End(xlDown).Row
If x > 1 Then
On Error Resume Next
With .Range("Ag36:Ag" & x)
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=IF([@[Contract Value/Risk Matrix - Code]]="""",""10%""*1,VLOOKUP([@[Contract Value/Risk Matrix - Code]],ProjectVRM,3,0))"
.NumberFormat = "0.00%"
End With
With .Range("Aj36:Aj" & x)
.FormulaR1C1 = "=IFERROR(IF([@[Start Date for Next Activity]]="""","""",([@[Start Date for Next Activity]]+[@[Nbr Days for Next Activity]]*[@[Per Cent % Complete" & Chr(10) & "" & Chr(10) & "]]%)),[@[Start Date for Next Activity]])"
.NumberFormat = "d/mm/yyyy"
End With
On Error GoTo 0
End If
End With