Private Sub CB_Valider2_Click()
Dim Tb_Nbre(1 To 8) As Single, Lab_Prix(1 To 8) As Single, P(1 To 8) As Single
Dim Lab_Total As Single
Dim i As Byte
Dim Nom As String
Application.ScreenUpdating = False
Nom = Lab_Nom
If Nom = "" Then MsgBox "Veuillez selectionner un Nom dans la Liste."
Lab_Total = 0
For i = 1 To 8
If Tb_Nbre(i) <> "" Then
P(i) = Tb_Nbre(i) * Lab_Prix(i)
Lab_Total = Lab_Total + P(i)
End If
Next i
Erase Tb_Nbre, Lab_Prix, P
Lab_Total = P1 + P2 + P3 + P4 + P5 + P6 + P7 + P8
With Sheets("Conso")
'Chercher son nom dans la feuille Conso colonne A
Set C = .Range("A5:A" & .Cells(.Rows.Count, 1).End(xlUp).Row).Find( _
What:=Nom, _
After:=.Range("A5"), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
'Son nom n'a pas été trouvé, la cellule sera la prochaine libre en bas de colonne
If C Is Nothing Then Set C = .Range("A" & .Cells(.Rows.Count, 1).End(xlUp).Row)(2)
'y mettre le nom
C.Value = Nom
'et la somme deux colonnes à droite
If C(1, 2).Value = "" Then C(1, 2) = CDec(Lab_Total) Else C(1, 2) = C(1, 2) + CDec(Lab_Total)
' Note la date
C(1, 3).Value = Date
End With
'Si La case Carte est superieur à zero
'Ajouter le client en fin de colonne b
If TB_Nbre1 = "" Then
Else
'Rajoute une carte supp au client
'Nom = LB_reglement
Worksheets("Client").Activate
Columns(1).Find(Nom, , , , , Previous).Select
ActiveCell.Offset(0, 1) = ActiveCell.Offset(0, 1).Value + 1
Set C = Sheets("Carte").Range("B" & Rows.Count).End(xlUp)(2)
C.Value = Nom
'Demande s'il a payé sa carte
If MsgBox("A t'il réglé sa carte ?", vbYesNo, "Règlement de la Carte Boisson.") = vbYes Then
'Oui on inscrit x à côté
C(1, 2) = "X"
'Else
End If
End If
Lab_Total.Caption = ClearContents
TB_Nbre1 = ClearContents
TB_Nbre2 = ClearContents
TB_Nbre3 = ClearContents
TB_Nbre4 = ClearContents
TB_Nbre5 = ClearContents
TB_Nbre6 = ClearContents
TB_Nbre7 = ClearContents
TB_Nbre8 = ClearContents
Lab_Nom = ClearContents
Lab_Nom.Visible = False
End Sub