Spinbutton & listbox

gabriel

XLDnaute Nouveau
Bonjour à toutes et & tous,
Je souhaiterais savoir s'il est possible de faire déplacer la sélection d'une listbox avec un spinbutton (toupie).
J'ai dans mon usf des textbox, une listbox & un spinbutton? pour le moment
la listbox + textbox => fonctionne correctement
Spinbutton + textbox => fonctionne correctement
ce qui ne fonctionne pas c'est la concordance entre listB et spinB...

Code:
Private Sub SpinButton1_Change()
Dim SP1 as Integer
SP1 = SpinButton1.Value
    If SP1 1 Then
        TextBox9 = Feuil4.Cells(SP1, 1) 'a
        TextBox21 = Feuil4.Cells(SP1, 2) 'b
        TextBox10 = Feuil4.Cells(SP1, 3) 'c
        TextBox20 = Feuil4.Cells(SP1, 4) 'd
        TextBox1 = Feuil4.Cells(SP1, 5) 'e
        TextBox2 = Feuil4.Cells(SP1, 6) 'f
        TextBox3 = Feuil4.Cells(SP1, 7) 'g
        TextBox5 = Feuil4.Cells(SP1, 8) 'h
        TextBox7 = Feuil4.Cells(SP1, 9) 'i
        TextBox8 = Feuil4.Cells(SP1, 10) 'j
        TextBox22 = Feuil4.Cells(SP1, 11) 'k
        TextBox11 = Feuil4.Cells(SP1, 12) 'l
        TextBox12 = Feuil4.Cells(SP1, 13) 'm
        TextBox13 = Feuil4.Cells(SP1, 14) 'n
        TextBox14 = Feuil4.Cells(SP1, 15) 'o
        TextBox15 = Feuil4.Cells(SP1, 16) 'p
        TextBox19 = Feuil4.Cells(SP1, 17) 'q
        TextBox17 = Feuil4.Cells(SP1, 18) 'r
        TextBox18 = Feuil4.Cells(SP1, 19) 's
        CheckBox2 = Feuil4.Cells(SP1, 20) 't

End If
End Sub

Et voici le code de la listBox

Code:
Private Sub ListBox1_Click()
Dim Lstindex as Integer
Lstindex = ListBox1.ListIndex + 2
TextBox1 = Sheets('Base').Range('E' & Lstindex)
TextBox2 = Sheets('Base').Range('F' & Lstindex)
TextBox3 = Sheets('Base').Range('G' & Lstindex)
TextBox5 = Sheets('Base').Range('H' & Lstindex)
TextBox7 = Sheets('Base').Range('I' & Lstindex)
TextBox8 = Sheets('Base').Range('J' & Lstindex)
TextBox22 = Sheets('Base').Range('K'& Lstindex)
TextBox9 = Sheets('Base').Range('A' & Lstindex)
TextBox10 = Sheets('Base').Range('C'& Lstindex)
TextBox11 = Sheets('Base').Range('L'& Lstindex)
TextBox12 = Sheets('Base').Range('M'& Lstindex)
TextBox13 = Sheets('Base').Range('N'& Lstindex)
TextBox14 = Sheets('Base').Range('O'& Lstindex)
TextBox15 = Sheets('Base').Range('P'& Lstindex)
TextBox19 = Sheets('Base').Range('Q'& Lstindex)
TextBox17 = Sheets('Base').Range('R'& Lstindex)
TextBox18 = Sheets('Base').Range('S'& Lstindex)
TextBox20 = Sheets('Base').Range('D'& Lstindex)
CheckBox2 = Sheets('Base').Range('T'& Lstindex)
TextBox21 = Sheets('Base').Range('B'& Lstindex)
End Sub

Est il possible de faire un lien entre ces deux éléments ?
J'espère avoir été suffisament clair... c'est pas évident d'expliquer quelque chose que l'on ne maitrise pas...
Merci de votre aide

Gabriel
 

Discussions similaires

Statistiques des forums

Discussions
312 295
Messages
2 086 960
Membres
103 407
dernier inscrit
elliott.joliman@bforbank.