plusieurs optionbutton pour une lisbox
Bonjour à tous
j'ai un petit souci avec l'alimentation d'un listbox.
Sur un userform, j'ai 13 optionbutton et une listbox
un choix d'optionbutton doit permettre d'alimenter la listbox différemment
voilà mon code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Sub UserForm_Initialize()
Set shl = Sheets("Liste")
srep1 = shl.Cells(2, 4)
srep2 = shl.Cells(3, 4)
End Sub
Sub opt2_Click()
If opt2 = True Then
srep = srep1
End If
liste
End Sub
Sub opt3_Click()
If opt3 = True Then
srep = srep2
End If
liste
End Sub
Sub liste()
lbox1.Clear
derlig = shl.Range("B1048576").End(xlUp).Row
For y = 2 To derlig
If shl.Cells(y, 3) = srep Then
lbox1.AddItem (Cells(y, 2))
End If
Next y
End Sub |
ca marche pour l'optionbutton 1 mais pas le 2 ???
une idée ??
cordialement