Thank you Greg,
My 90% problem is solved.
However, when i tried to impliment the code in my form sheet, i am facing an issue. The installment number in the table remains 1 for all the installment. The table that you created changed the number for all the installment, however, the same is not working in the document. I made some changes in the code while using it in my form, did i make any mistake in entering the code?
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim lngCount As Long
Dim oTbl As Word.Table
Select Case ContentControl.Title
Case "Installments"
If ActiveDocument.ProtectionType <> wdNoProtection Then ActiveDocument.Unprotect
Set oTbl = Bookmarks("Inst1").Range.Tables(1)
For lngCount = oTbl.Rows.Count To 5 Step -1
oTbl.Rows.Last.Delete
Next lngCount
For lngCount = 2 To CLng(ContentControl.Range.Text)
oTbl.Rows.Last.Range.Copy
oTbl.Rows.Last.Range.Paste
Next lngCount
For lngCount = 1 To CLng(ContentControl.Range.Text)
If IsNumeric(oTbl.Rows(2).Cells(2).Range.ContentControls(1).Range.Text) Then
oTbl.Rows(lngCount + 3).Cells(2).Range.ContentControls(1).Range.Text = _
oTbl.Rows(2).Cells(2).Range.ContentControls(1).Range.Text / CLng(ContentControl.Range.Text)
Else
oTbl.Rows(lngCount + 3).Cells(2).Range.ContentControls(1).Range.Text = "$0.00"
End If
Next lngCount
oTbl.Range.Fields.Update
oTbl.Rows(4).Cells(2).Range.ContentControls(1).Range.Select
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Select
End Sub