1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| Private Sub T_Add_CBOK_Click()
Dim LR As Integer, test As Integer
Set Wb = Workbooks(OB4.Caption & Frame1.Caption)
Set WbO = Wb.Sheets(T_Add_TBAC.Text)
Set t = WbO.ListObjects("MyTable" & T_Add_TBAC.Text)
If vbYes = MsgBox("Confirmez-vous la saisie des données", vbYesNo) Then
t.ListRows.Add
LR = t.ListColumns(1).DataBodyRange.Rows.Count
With t.DataBodyRange
.Cells(LR, 1) = T_Add_CBSite.Value
If T_Add_CBSite.Value = "BIC" Then
.Cells(LR, 2) = T_Add_CBBIC.Value
End If
.Cells(LR, 3) = Format(Now(), "dd/mm/yyyy")
.Cells(LR, 4) = T_Add_TBINV.Text
'Do
'test = Application.InputBox(prompt:="Veuillez saisir l'année de la prestation - " & T_Add_TBAC.Value & " ou " & T_Add_TBAC.Value - 1, Type:=2)
'Loop Until test = T_Add_TBAC.Value Or test = T_Add_TBAC.Value - 1
.Cells(LR, 11) = test
.Cells(LR, 15) = T_Add_TBSAP.Text
.Cells(LR, 16) = T_Add_TBCC.Text
.Cells(LR, 23) = T_Add_TBTTC.Value
.Cells(LR, 23).NumberFormat = "#,##0.00"
.Cells(LR, 29) = T_Add_CBP4.Value
.Cells(LR, 30) = T_Add_CBP5.Value
.Cells(LR, 31) = T_Add_CBBG.Value
.Cells(LR, 18) = T_Add_TBSB.Text
If T_Add_OBCR.Value = True Then
.Cells(LR, 5) = T_Add_TBPOCR.Text
.Cells(LR, 12) = "C" & test
.Cells(LR, 13) = .Cells(LR, 12) & .Cells(LR, 5)
Else
.Cells(LR, 6) = T_Add_TBPOCR.Text
.Cells(LR, 12) = "P" & test
.Cells(LR, 13) = .Cells(LR, 12)
End If
.Cells(LR, 7) = T_Add_TBLib.Text
.Cells(LR, 9) = T_Add_TBSup.Text
.Cells(LR, 10) = T_Add_TBM.Value
End With
Else
LR = t.ListColumns(1).DataBodyRange.Rows.Count
t.ListRows(LR).Delete
End If
End Sub |