Option Explicit
Dim PhaseInit As Boolean, Cell As Range, TLig() As Long
Dim LMax As Long, L As Long
Private Sub Userform_Initialize()
LMax = FBase.Range("A65536").End(xlUp).Row
PhaseInit = True
For L = 2 To LMax
ComboBox1.Text = FBase.Cells(L, "E").Value
If ComboBox1.ListIndex = -1 Then ComboBox1.AddItem FBase.Cells(L, "E").Value
Next L
PhaseInit = False
ComboBox1.Text = FBase.[E2].Value
End Sub
'
Private Sub Combobox1_Change(): If PhaseInit Then Exit Sub
If ComboBox1 = "" Then ComboBox1.SetFocus: Exit Sub
PhaseInit = True
ComboBox2.Clear
ReDim TLig(0 To LMax - 2) As Long
For L = 2 To LMax
If FBase.Cells(L, "E").Value = ComboBox1.Value Then
ComboBox2.AddItem FBase.Cells(L, "A").Value
TLig(ComboBox2.ListCount - 1) = L
End If
If FBase.Cells(L, "E").Value = ComboBox1.Value Then
ComboBox3.AddItem FBase.Cells(L, "G").Value
TLig(ComboBox3.ListCount - 1) = L
End If
Next L
PhaseInit = False
End Sub
Private Sub Combobox2_Change(): If PhaseInit Then Exit Sub
TextBox2.Enabled = True
TextBox3.Enabled = True
TextBox4.Enabled = True
TextBox5.Enabled = True
TextBox6.Enabled = True
TextBox7.Enabled = True
L = TLig(ComboBox2.ListIndex)
TextBox2.Value = FBase.Cells(L, 8)
TextBox3.Value = FBase.Cells(L, 9)
TextBox4.Value = FBase.Cells(L, 10)
TextBox5.Value = FBase.Cells(L, 11)
TextBox6.Value = FBase.Cells(L, 12)
TextBox7.Value = FBase.Cells(L, 13)
End Sub
'
Private Sub ComboBox3_Change(): If PhaseInit Then Exit Sub
L = TLig(ComboBox3.ListIndex)
End Sub
Private Sub CommandButton1_Click()
L = TLig(ComboBox2.ListIndex)
FBase.Cells(L, 8) = TextBox2.Value
FBase.Cells(L, 9) = TextBox3.Value
FBase.Cells(L, 10) = TextBox4.Value
FBase.Cells(L, 11) = TextBox5.Value
FBase.Cells(L, 12) = TextBox6.Value
FBase.Cells(L, 13) = TextBox7.Value
End Sub
'
Private Sub Commandbutton2_Click()
Unload Me
End Sub