Répétition d'action sur la condition "change" de plusieurs combobox.
Bonjour à tous,
je viens vers vous car je suis entrain de faire un userform permettant de générer un devis sur une trame.
après diverses informations sur mon userform, j'ai créé un tableau de la façon suivante:
comboboxRef | TextBoxDesignation | |TextBox |TextBoxPrixUnitaire | Etc.
cette ligne ce répète tout de même 16 fois, et c'est là qu'est mon problème.
j'ai créé la condition suivante pour la première ligne, cependant je ne sais pas comment faire pour que ça se répète sur les 15 autres sans copier 15 fois le même code.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
Private Sub ComboBoxRef1_Change()
On Error Resume Next
Dim I As Integer
For I = 1 To [bdref].Rows.Count
If ComboBoxRef1.Text = [bdref].Cells(I, 1) Then
TextBoxDesignation1 = [bdref].Cells(I, 2)
TextBoxPU1 = [bdref].Cells(I, 3)
End If
Next I
TextBoxRemise1 = 0
TextBoxQu1 = 1
TextBoxPR1 = TextBoxPU1 - (TextBoxPU1 * (TextBoxRemise1 / 100))
TextBoxPT1 = TextBoxPR1 * TextBoxQu1
If ComboBoxRef1 = "" Then
TextBoxRemise1 = ""
TextBoxQu1 = ""
TextBoxPT1 = ""
TextBoxPR1 = ""
End If
End Sub |
Pouvez-vous m'aider SVP ??? je sais qu'il y a une solution permettant d'effectuer cette opération à chaque événement "change" de toute mes combobox mais mes limites m'en empêchent.
Par avance merci pour votre aide