Option Explicit
Private WithEvents CL As ComboBoxLiées, WithEvents CA As ControlsAssociés, LCou As Long, TVL()
Private Sub UserForm_Initialize()
Set CL = CLsCAs.Création.ComboBoxLiées: CL.Plage Feuil1
Set CA = CLsCAs.Création.ControlsAssociés: Set CA.Colonnes = CL.Colonnes
CL.Add Me.CBxDate, "Date"
CL.Add Me.CBxRéf, "Référence"
CA.Add Me.TBxDsgn, "Désignation"
CA.Add Me.TBxProv, "Provenance"
CA.Add Me.TBxDest, "Destination"
CA.Add Me.TBxEmpl, "Emplacement"
CL.CouleurSympa
CL.Actualiser
End Sub
Private Sub CL_Change(ByVal Complet As Boolean, ByVal NbrLgn As Long)
If NbrLgn = 0 And Complet Then
CBnValider.Enabled = True: CBnValider.Caption = "Ajouter"
ElseIf NbrLgn = 1 Then
CBnValider.Enabled = True: CBnValider.Caption = "Modifier"
Else
CBnValider.Enabled = False: CBnValider.Caption = "…"
End If
LCou = 0
ReDim TVL(1 To 1, 1 To CL.Colonnes.Count)
CA.ValeursDepuis TVL
End Sub
Private Sub CL_BingoUn(ByVal Ligne As Long)
LCou = Ligne
TVL = CL.Lignes(LCou).Range.Value
CA.ValeursDepuis TVL
End Sub
Private Sub CBnEchap_Click(): If CL.ChangéÀLEchap Then Exit Sub
CL.Nettoyer
End Sub
Private Sub CBnValider_Click()
CA.ValeursVers TVL
If LCou = 0 Then
CL.ValeursVers TVL
CL.Lignes.Add.Range.Value = TVL
CL.Actualiser
Else
CL.Lignes(LCou).Range.Value = TVL
End If
End Sub
Private Sub CBnSuppr_Click()
If LCou = 0 Then Exit Sub
CL.Lignes(LCou).Delete
CL.Actualiser
End Sub