Private Sub ComboBox1_Change()
Dim j&
Dim Id&
'---
Id& = ComboBox1.ListIndex
For j& = 2 To ComboBox1.ColumnCount - 1
If Id& >= 0 Then
Me.Controls("TextBox" & j& - 1) = ComboBox1.List(Id&, j&)
Else
Me.Controls("TextBox" & j& - 1) = ""
End If
Next j&
End Sub
Private Sub ComboBox1_Enter()
Dim CT As Control
Dim bool
Dim A$
Dim R
Dim var
Dim i&
Dim j&
Dim cpt&
Dim T()
'---
For Each CT In Me.Controls
If TypeName(CT) = "OptionButton" Then
If CT = True Then
A$ = CT.Caption
bool = True
Exit For
End If
End If
Next CT
If Not bool Then Exit Sub
'---
Set R = Sheets("Feuil1").[a1].CurrentRegion
var = R
For i& = 1 To UBound(var, 1)
If var(i&, 2) = A$ Then
cpt& = cpt& + 1
ReDim Preserve T(1 To UBound(var, 2), 1 To cpt&)
For j& = 1 To UBound(var, 2)
T(j&, cpt&) = var(i&, j&)
Next j&
End If
Next i&
'---
With ComboBox1
.ColumnCount = UBound(var, 2)
.ColumnWidths = "20;0;0;0;0;0;0;0;0;0;0"
.List = Application.WorksheetFunction.Transpose(T)
End With
End Sub
Private Sub OptionButton1_Click()
Me.ComboBox1.Clear
End Sub
Private Sub OptionButton2_Click()
Me.ComboBox1.Clear
End Sub
Private Sub OptionButton3_Click()
Me.ComboBox1.Clear
End Sub