Dim txt(3 To 368) As New Classe1, i As Long
Sub UserForm_Initialize()
For i = 3 To 368: Set txt(i).txt = Controls("Textbox" & i): Next i
Label1.Caption = "mode : Recherche"
initialisecombo
End Sub
Private Sub ComboBox1_Click()
CommandButton3.Visible = True
Label1.Caption = "mode : Modification"
With ComboBox1
For i = 1 To 221
Controls("TextBox" & i) = Sheets("feuil2").Cells(.List(.ListIndex, 1), i)
Next i
For i = 222 To 442
Controls("TextBox" & i) = Sheets("feuil2").Cells(.List(.ListIndex, 1), i)
Next i
End With
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub CommandButton3_Click()
With ComboBox1
For i = 1 To 369
Sheets("feuil2").Cells(.List(.ListIndex, 1), i) = Controls("TextBox" & i)
Controls("TextBox" & i) = ""
Next i
.ListIndex = -1
End With
CommandButton3.Visible = False
CommandButton2.Visible = False
End Sub
Public Sub initialisecombo()
Dim i As Variant
With ComboBox1
.ColumnCount = 2
.ColumnWidths = "50;0"
End With
With Sheets("feuil2")
For i = 2 To .Range("a65536").End(xlUp).Row
ComboBox1.AddItem
ComboBox1.List(ComboBox1.ListCount - 1, 0) = .Cells(i, 1) & " " & .Cells(i, 2)
ComboBox1.List(ComboBox1.ListCount - 1, 1) = i
Next i
End With
End Sub