Bonjour,
Dans le module 1, tu mets ceci :
Public DerLig As Long, DerCol As Long, I As Long
Public Plg1 As Range, Plg2 As Range, PlgT As Range
Sub OuvreUsf()
UserForm1.Show 0
End Sub
et dans le code de l'USF, tu remplaces tout par ceci :
****Attention, j'ai interverti les 2 ComboBox, ComboBox1 pour les classes, et ComboBox2 pour les circonférences****
Private Sub ComboBox1_Change()
Me.TextBox1.Value = ""
End Sub
Private Sub ComboBox2_Change()
Me.TextBox1.Value = ""
End Sub
Private Sub CommandButton1_Click()
If Me.ComboBox1 <> "" And Me.ComboBox2 <> "" Then
Me.TextBox1 = Format(Application.Index(PlgT, Application.Match(Me.ComboBox1, Plg1, 0), Application.Match(Val(Me.ComboBox2), Plg2, 0)), "#0.000")
End If
End Sub
Private Sub UserForm_Initialize()
With Feuil1
DerLig = .Range("A" & Rows.Count).End(xlUp).Row
DerCol = .Cells(3, Columns.Count).End(xlToLeft).Column
Set Plg1 = .Range("A5:A" & DerLig)
Set Plg2 = .Range("B3", .Cells(3, DerCol))
Set PlgT = .Range("B5", .Cells(DerLig, DerCol))
For I = 5 To DerLig
Me.ComboBox1.AddItem .Range("A" & I).Value
Next I
For I = 2 To DerCol
Me.ComboBox2.AddItem .Cells(3, I).Value
Next I
End With
End Sub
Le fichier :
Bon courage