Private Sub cbAjout_Click()
Dim rp$, Cli$, k%, sMonth$, m As Variant, rTitre As Range
Cli = cbxCli.Value: rp = cbxProd.Value
If Cli = "" Or rp = "" Then Exit Sub
If tbNDate.Value <> "" Then
If IsDate(tbNDate.Value) Then
DéprotProtF Cli
With Worksheets(Cli)
'If pr > 0 Then
'.Cells(pr, 1).End(xlToRight)(1, 2) = CDate(tbNDate.Value)
'Else
Set rTitre = .[d3:o3]
With .Cells(1, 1).End(xlDown)(2)
.Cells(1, 1) = rp
.Cells(1, 2) = tbProd.Value
.Cells(1, 3) = CDate(tbNDate.Value)
sMonth = Format(CDate(TextBox1.Value), "mm/yy")
m = Application.Match(sMonth, rTitre, 0)
If Not IsError(m) Then
.Cells(1, 3 + m) = "X"
End If
End With
'End If
End With
DéprotProtF Cli, True
Else
MsgBox "Saisir une date valide !", vbCritical, "Date invalide"
End If
cbxProd.ListIndex = -1: lbxDates.Clear
End If
End Sub