Private Sub Cmd_Enreg_Click()
Dim LR As ListRow
'Vérification qu'aucune information n'a été ommise
If Aucun_Oublis = "OUBLIS" Then
Exit Sub
End If
[B][COLOR=rgb(226, 80, 65)] With ActiveSheet.ListObjects(1) (Ici est le problème: choix tableau)[/COLOR][/B]
Set LR = .ListRows.Add
With LR.Range
.Cells(1, 1).FormulaR1C1 = "=MAX(R[-1]C:R[-1]C)+1"
.Cells(1, 2) = CDate(Tb_Date.value)
.Cells(1, 3) = ComboBoxTiers.value
.Cells(1, 4) = ComboBoxMode.value
.Cells(1, 5) = ComboBoxGroupe.value
.Cells(1, 6) = ComboBoxCateg.value
If OPTdépense.value = True Then
.Cells(1, 7) = "Dépense"
.Cells(1, 9) = CCur(Format(Txt_Banq.value, "##,##0.00 €"))
.Cells(1, 9).Font.ColorIndex = 3
ElseIf OPTrevenu.value = True Then
.Cells(1, 7) = "Recette"
.Cells(1, 10) = CCur(Format(Txt_Banq.value, "##,##0.00 €"))
End If
If OP_bool_pointe.value = True Then
.Cells(1, 8) = "þ"
.Cells(1, 12) = OP_dat_pointe.value
Else
.Cells(1, 8) = "o"
.Cells(1, 12) = ""
End If
.Cells(1, 11).FormulaR1C1 = "=R[-1]C+RC[-1]-RC[-2]"
.Cells(1, 11).NumberFormatLocal = "# ##0,00 €;[Rouge]-# ##0,00 €]_-"
'Tri sur la provenance
.DataBodyRange.Sort key1:=.ListColumns("Date de l'Opération").DataBodyRange, Header:=xlYes, Order1:=xlAscending
End With
End With
Set LR = Nothing
Call MiseEnFormeFeuil
Sheets("Balance").Cells(Lbl_ModNumLgn.Caption, 8) = CCur(Format(Txt_Banq.value, "##,##0.00 €"))
MsgBox "vos données ont bien été enregistrées dans la base de données", vbOKOnly + vbInformation, "confirmation"
Call Btn_Ajouter_Click
End Sub