XL 2013 Simplifier alimentation listbox

vmax67

XLDnaute Occasionnel
Bonjour à tous

j'aimerai simplifier l'alimentation de ma listbox.

Actuellement je dois activer un optionbutton 1 ou 2, après je dois choisir une ville dans la combobox
pour alimenter ma Listbox. J'aimerai alimenter directement la listbox après activation d'un des optiontbuton
puisque l'info ville se trouve déjà dans le label 9 pour optiontbuton 1 et label 10 pour optiontbuton 2.

Par avance je vous remercie pour votre aide.

Vmax
 

Pièces jointes

  • Test Menu.xlsm
    72.6 KB · Affichages: 61
  • Test Menu.xlsm
    72.6 KB · Affichages: 62

Lone-wolf

XLDnaute Barbatruc
Re : Simplifier alimentation listbox

Re,

où est-ce que tu as mis C1.ListIndex = Label9.Caption ? J'ai testé et pas de problème.

test.jpg




A+ :cool:
 

Pièces jointes

  • test.jpg
    test.jpg
    44.2 KB · Affichages: 78
Dernière édition:

laetitia90

XLDnaute Barbatruc
Re : Simplifier alimentation listbox

bonjour vmax67:) Lone-wolf:)
demarre seulement avec ce code dans user pour voir si cela fonctionne apres on verra:)

Code:
Private Sub UserForm_Initialize()
NomOnglet = ActiveSheet.Name & " " & [E7] & " - " & [L7]
Label1.Caption = "LISTES DES JOUEURS"
Label2.Caption = "Joueur 1  -------> " & [A9]
Label3.Caption = "Joueur 2  -------> " & [A11]
Label4.Caption = "Joueur 3  -------> " & [A13]
Label6.Caption = "Joueur 1  -------> " & [A9]
Label7.Caption = "Joueur 2  -------> " & [A11]
Label8.Caption = "Joueur 3  -------> " & [A13]
Label9.Caption = [E7]
Label10.Caption = [L7]
UserForm1.Label17.Caption = Sheets("Saisie").Range("A56").Value
 OptionButton2 = 1: OptionButton1 = 1
End Sub
Private Sub OptionButton1_Change()
 Dim t(), ta(), i As Long, x As Long, k As Long, z
 On Error Resume Next
  z = IIf(OptionButton1, Label9, Label10)
  lbx1.Clear
  x = 1
  t = Feuil9.Range("c2:h" & Feuil9.Cells(Rows.Count, 1).End(3).Row).Value
  For i = 1 To UBound(t)
  If t(i, 1) = z Then
  ReDim Preserve ta(1 To 6, 1 To x)
  For k = 1 To 6
  ta(k, x) = t(i, k)
  Next k: x = x + 2: End If: Next i
  lbx1.Column = ta
 End Sub
 

laetitia90

XLDnaute Barbatruc
Re : Simplifier alimentation listbox

re:):)

pourquoi dupliqué le code pour OptioButton2 ????

on utilise la proprietee change
Private Sub OptionButton1_Change

donc quand tu click sur optio...2 tu declenches evenement change de optio...1 qui passe a false

z = IIf(OptionButton1, Label9, Label10)

je pense que tu vas comprendre :eek:
 

Discussions similaires

Statistiques des forums

Discussions
312 315
Messages
2 087 168
Membres
103 489
dernier inscrit
CACCA