I am trying to creat a increment arrears format using exlel VBA. I tryied to diplay the below formula in my format cell. Not working correctly in my macro, but the formula is working correcly in my excel format.

[/b]My Formula with Variables :[/b]

Newsal_01 = ws.Range("D" & (startRow - 1) + i).Value '''' D11

Newsal_02 = ws.Range("D" & startRow + i).Value '''' D12

Date_Month = ws.Range("A" & startRow + i).Value '''' A12

IncreDay = ws.Range("B" & startRow + i).Value '''' B12

Oldsal_01 = ws.Range("C" & (startRow - 1) + i).Value '''' C11

Oldsal_02 = ws.Range("C" & startRow + i).Value '''' C12

ws.Range("E" & startRow + i).Formula = "=ROUND((Newsal_01/(DAY(EOMONTH(Date_Month,0)))*(IF(IncreDay>0,(IncreDay-1),IncreDay))+(Newsal_02/(DAY(EOMONTH(Date_Month,0)))*((DAY(EOMONTH(Date_Month,0)))-(IF(IncreDay>0,(IncreDay-1),IncreDay))))),2)-ROUND((Oldsal_01/(DAY(EOMONTH(Date_Month,0)))*(IF(IncreDay>0,(IncreDay-1),IncreDay))+(Oldsal_02/(DAY(EOMONTH(Date_Month,0)))*((DAY(EOMONTH(Date_Month,0)))-(IF(IncreDay>0,(IncreDay-1),IncreDay))))),2)"

**Without Above Vriables:**

ws.Range("E" & i).Formula = "=ROUND((D" & i - 1 & "/(DAY(EOMONTH(A" & i & ",0))*(IF(B" & i & ">0,(B" & i & "-1),B" & i & ")))+(D" & i & "/(DAY(EOMONTH(A" & i & ",0))*((DAY(EOMONTH(A" & i & ",0))-(IF(B" & i & ">0,(B" & i & "-1),B" & i & "))))),2)-ROUND((C" & i - 1 & "/(DAY(EOMONTH(A" & i & ",0))*(IF(B" & i & ">0,(B" & i & "-1),B" & i & "))+(C" & i & "/(DAY(EOMONTH(A" & i & ",0))*((DAY(EOMONTH(A" & i & ",0))-(IF(B" & i & ">0,(B" & i & "-1),B" & i & "))))),2)"

Both formulas not working. pleace help me. (My Format attached herewith)

BR,

Priyantha.