insérer dans combobox avec textboxvalue
bonjour,
je voudrais insérer dans une listboxQte, la valeur saisie dans la TextBoxQte,
j'y arrive parfaitement avec une comboboxQte mais souhaite simplifier la tâche à l'utilisateur en lui faisant simplement saisir dans une TextBoxQte la qté souhaitée plutôt que d'utiliser une combobox
mais à chaque fois, j'ai une erreur 424 sur Qte_A_Inserer et je ne comprends pas où est le problème
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 29 30 31 32
| 'insertion dans la listboxQte au dessus de la ligne sélectionnée de la qté sélectionnée
Dim Qte_A_Inserer As Range
With TextBoxQte
If TextBoxQte.Value <> "" Then
Set Qte_A_Inserer = TextBoxQte.Value
End If
End With
'code qui fonctionne avec la comboxboxQte :
'With ComboBoxQte
'If .ListIndex <> -1 Then
' Set Qte_A_Inserer = RgTextBoxQte(.ListIndex + 1)
'End If
' End With
Dim ligQte As Integer
ligQte = ListBoxQte.ListCount 'Nombre de ligne dans la listbox
posit = ListBoxQte.ListIndex
ListBoxQte.AddItem " "
For i = ligQte To posit + 1 Step -1
For j = 0 To 0 ' 1 colonnes
ListBoxQte.List(i, j) = ListBoxQte.List(i - 1, j)
Next j
Next i
ListBoxQte.List(posit, 0) = Qte_A_Inserer
End Sub |
Merci par avance de votre aide
synchroniser l'affichage entre listbox
bonjour Wilfried,
merci c'est + que parfait
dis moi, je voudrais, toujours pour simplifier et éviter les risques d'erreur, synchroniser l'affichage entre les ListBoxArtDes et ListBoxQte
code initialisation formulaire :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| Private Sub UserForm_Initialize()
With Sheets("CodesFeux")
Me.ComboBoxFeux.RowSource = .Name & "!" & .Range("A1:B" & .Range("A65536").End(xlUp).Row).Address
End With
With Sheets("articles")
Set RgComboBoxArticle1 = .Range("A1:A" & .Range("A65536").End(xlUp).Row)
Set RgComboBoxArticle2 = .Range("B1:B" & .Range("B65536").End(xlUp).Row)
Me.ComboBoxArticle.List = RgComboBoxArticle1.Value
End With
With Sheets("articles")
Set RgComboBoxQte = .Range("F1:F" & .Range("F65536").End(xlUp).Row)
Me.ComboBoxQte.List = RgComboBoxQte.Value
End With
End Sub |
code qui devrait synchroniser les 2 listboxes :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Private Sub ListBoxArtDes_Click()
With ListBoxQte
.TopIndex = ListBoxArtDes.TopIndex
.ListIndex = ListBoxArtDes.ListIndex
End With
End Sub
Private Sub ListBoxQte_Click()
With ListBoxArtDes
.TopIndex = ListBoxQte.TopIndex
.ListIndex = ListBoxQte.ListIndex
End With
End Sub |
pourquoi ? qu'ai-je omis ?
merci d'avance