Checkbox / OptionButton selection de listes

Geraldine

XLDnaute Occasionnel
Bonjour le forum,

Dans une userform, j'ai une combobox qui m'affiche la liste des mes articles ("ARTICLE"), stockés dans un classeur different mais ouvert.
Je voudrais à présent, rajouter un Checkbox ou OptionButton afin de selectionner differentes listes soit "ARTICLE", "ARTICLE1", "ARTICLE2" etc ...
Comment modifier ce code selon les modifications recherchées,

Option Explicit
Dim WbkC As Workbook, ShtC As Worksheet

Private Sub userform_initialize()
Dim DerLig As Integer, NumPx As Integer, VArt As String
Set WbkC = Workbooks("DEVIS.xls")
Set ShtC = WbkC.Worksheets("ARTICLE")
DerLig = ShtC.Range("A65536").End(xlUp).Row
For NumPx = 4 To DerLig
VArt = ShtC.Range("A" & NumPx).Value
Me.ComboBox1.AddItem VArt
Next NumPx
End Sub

Private Sub ComboBox1_Change()
Dim Lig As Integer
Lig = Me.ComboBox1.ListIndex
Me.TextBox1.Value = ShtC.Range("L" & 3 + Lig + 1).Value
End Sub

Cordialement, Géraldine
 

Bebere

XLDnaute Barbatruc
Re : Checkbox / OptionButton selection de listes

bonjour Geraldine
une frame et 3 optionbutton
tu peux en ajouter,si un optionbutton est true,les autres false
à bientôt
 

Pièces jointes

  • Geraldine.xls
    19.5 KB · Affichages: 90
  • Geraldine.xls
    19.5 KB · Affichages: 97
  • Geraldine.xls
    19.5 KB · Affichages: 104

Bebere

XLDnaute Barbatruc
Re : Checkbox / OptionButton selection de listes

salut
j'ai excel 2000,si tu as une version plus haute?

tu mets frame1 dans usf,OptionButton1,2 et 3 dans frame1

Option Explicit

Dim WbkC As Workbook, ShtC As Worksheet

Private Sub OptionButton1_Click()
If OptionButton1 Then Set ShtC = WbkC.Worksheets("ARTICLE")
IniComboBox1
End Sub

Private Sub OptionButton2_Click()
If OptionButton2 Then Set ShtC = WbkC.Worksheets("ARTICLE1")
IniComboBox1
End Sub

Private Sub OptionButton3_Click()
If OptionButton3 Then Set ShtC = WbkC.Worksheets("ARTICLE2")
IniComboBox1
End Sub

Private Sub userform_initialize()

Set WbkC = Workbooks("DEVIS.xls")
OptionButton1 = True

End Sub

Private Sub IniComboBox1()
Dim DerLig As Integer, NumPx As Integer, VArt As String

ComboBox1.Clear
DerLig = ShtC.Range("A65536").End(xlUp).Row
For NumPx = 4 To DerLig
Me.ComboBox1.AddItem ShtC.Range("A" & NumPx).Value
Next NumPx

End Sub
Private Sub ComboBox1_Change()
Dim Lig As Integer
Lig = Me.ComboBox1.ListIndex
Me.TextBox1.Value = ShtC.Range("L" & 3 + Lig + 1).Value
End Sub

à bientôt
 

Geraldine

XLDnaute Occasionnel
Re : Checkbox / OptionButton selection de listes

re bebere, j'ai joint 2 fichiers parce que je n'y parviens pas. Mais comme tu as excel 2000, ça vas être compliqué.

Je voudrais savoir si c'est possible d'avoir une seule feuille article "Feuil1" dans classeur1, et que dans classeur2/userform, les OptionButton permettent un Filtre Automatique du type

OptionButton1 (SOL) > je choisis dans la liste "feuil1" tous les classifications SOL

OptionButton2 (plafond) > je choisis dans la liste "feuil1" tous les classifications plafond

OptionButton3 (mur) > je choisis dans la liste "feuil1" tous les classifications mur


merci, cordialement
Géraldine
 

Pièces jointes

  • Classeur.zip
    11.8 KB · Affichages: 53
  • Classeur.zip
    11.8 KB · Affichages: 60
  • Classeur.zip
    11.8 KB · Affichages: 51

Discussions similaires

Réponses
6
Affichages
245

Statistiques des forums

Discussions
312 215
Messages
2 086 326
Membres
103 180
dernier inscrit
Vcr