Option Explicit
Dim ary1 As Variant, ary2 As Variant, ary3 As Variant, aryRISK As Variant
Dim tbl1 As ListObject, tbl2 As ListObject, tbl3 As ListObject, tblRISK As ListObject
Dim ws1 As Worksheet, ws2 As Worksheet
Dim newrow As ListRow
Dim reins As String
Dim msgValue As VbMsgBoxResult
Dim X As Long
Private Sub UserForm_Initialize()
Set ws1 = LIVE
Set tblRISK = ws1.ListObjects("FAC_RISKS")
Set ws2 = Sheet2
Set tbl1 = ws2.ListObjects("Table1")
Set tbl2 = ws2.ListObjects("Table2")
Set tbl3 = ws2.ListObjects("Table3")
With tbl1
If .ListRows.Count = 1 Then
Me.cedent.AddItem .DataBodyRange(1)
Else
ary1 = .DataBodyRange
Me.cedent.List = ary1
End If
End With
With tbl2
If .ListRows.Count = 1 Then
Me.status.AddItem .DataBodyRange(1)
Else
ary1 = .DataBodyRange
Me.status.List = ary1
End If
End With
With tbl3
If .ListRows.Count = 1 Then
Me.reinsurers.AddItem .DataBodyRange(1)
Else
ary1 = .DataBodyRange
Me.reinsurers.List = ary1
End If
End With
End Sub
Private Sub ADDCommandButton1_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do You Want To Save The Amended Details?", 36, "Confirmation")
If msgValue = vbNo Then Exit Sub
With tblRISK.ListRows(ActiveCell.Row - 2).Range(, 1)
.Value = Me.status.Value
.Offset(, 1).Value = Me.reference.Value
.Offset(, 2).Value = Me.insured.Value
.Offset(, 3).Value = CDate(Me.startdate.Value)
.Offset(, 4).Value = CDate(Me.enddate.Value)
.Offset(, 5).Value = Format(Me.share.Value / 100, "Percent")
.Offset(, 6).Value = Me.reinsurers.Value
.Offset(, 7).Value = Me.brokerage.Value
.Offset(, 8).Value = Me.excess.Value
.Offset(, 9).Value = Me.cedent.Value
End With
MsgBox "Record Updated", 64, "Updated"
Unload Me
End Sub
Private Sub brokerage_Change()
Dim msoMetaPropertyTypeCurrency
End Sub
Private Sub excess_Change()
Dim isCurrency
End Sub
Private Sub reinsurers_Change()
Dim i As Integer
reinsurers.MultiSelect = fmMultiSelectMulti
If Checked Then
For i = 0 To reinsurers.ListCount - 1
Next i
End If
End Sub
Private Sub share_Change()
Dim IsNumeric
End Sub
Private Sub UserForm_Activate()
status.Value = Cells(Selection.Row, "A").Value
reference.Value = Cells(Selection.Row, "B").Value
insured.Value = Cells(Selection.Row, "C").Value
startdate.Value = Format$(Cells(Selection.Row, "D").Value)
enddate.Value = Format$(Cells(Selection.Row, "E").Value)
share.Value = Cells(Selection.Row, "F").Value * 100
Me.reinsurers.Value = Cells(Selection.Row, "G").Value
brokerage.Value = Cells(Selection.Row, "H").Value
excess.Value = Cells(Selection.Row, "I").Value
cedent.Value = Cells(Selection.Row, "J").Value
End Sub