Listbox
amine69500
Messages postés
471
Statut
Membre
-
amine69500 Messages postés 471 Statut Membre -
amine69500 Messages postés 471 Statut Membre -
Bonjour,
j'ai deux listbox : listbox1 et listbox2 et deux bouton : ajouter et supprimer
listbox1 : rowsource = ( A75: B176), quand je selectione une ligne dans listbox1, et je fai ajouter , cette derniere est place dans la listbox2, et quand je selectionne une ligne dans la listbox2 et je fais supprimer , cette derniere est supprimer de ma listbox2
je souhaiterai savoir si c'est possible , que lorsque je selectionne une ligne dans la listbox1 exemple: (A75:B75) et je fais ajouter, cette derniere se met dans la listbox2 (ok) , et met une valeur true dans la cellule de droite c'est-a-dire dans la cellule C75.
merci de votre aide
voila mon code des boutons
bouton ajouter :
Private Sub AddButton_Click()
Dim i As Integer
Dim LigneSuivante As Long
If ListBox1.ListIndex = -1 Then Exit Sub
LigneSuivante = _
Application.WorksheetFunction.CountA(Range("A:A")) - 464
ListBox2.AddItem ListBox1.Text
Cells(LigneSuivante, 3) = True
ListBox3.AddItem ListBox1.Value
Cells(LigneSuivante, 4) = True
' Voir s'il existe des doublons
For i = 0 To ListBox3.ListCount - 1
If ListBox1.Value = ListBox3.List(i) Then
Beep
Exit Sub
End If
Next i
End Sub
Bouton supprimer
Private Sub DeleteButton_Click()
If ListBox2.ListIndex = -1 Then Exit Sub
ListBox2.RemoveItem ListBox2.ListIndex
ListBox3.RemoveItem ListBox3.ListIndex
End Sub
merci de votre aide
j'ai deux listbox : listbox1 et listbox2 et deux bouton : ajouter et supprimer
listbox1 : rowsource = ( A75: B176), quand je selectione une ligne dans listbox1, et je fai ajouter , cette derniere est place dans la listbox2, et quand je selectionne une ligne dans la listbox2 et je fais supprimer , cette derniere est supprimer de ma listbox2
je souhaiterai savoir si c'est possible , que lorsque je selectionne une ligne dans la listbox1 exemple: (A75:B75) et je fais ajouter, cette derniere se met dans la listbox2 (ok) , et met une valeur true dans la cellule de droite c'est-a-dire dans la cellule C75.
merci de votre aide
voila mon code des boutons
bouton ajouter :
Private Sub AddButton_Click()
Dim i As Integer
Dim LigneSuivante As Long
If ListBox1.ListIndex = -1 Then Exit Sub
LigneSuivante = _
Application.WorksheetFunction.CountA(Range("A:A")) - 464
ListBox2.AddItem ListBox1.Text
Cells(LigneSuivante, 3) = True
ListBox3.AddItem ListBox1.Value
Cells(LigneSuivante, 4) = True
' Voir s'il existe des doublons
For i = 0 To ListBox3.ListCount - 1
If ListBox1.Value = ListBox3.List(i) Then
Beep
Exit Sub
End If
Next i
End Sub
Bouton supprimer
Private Sub DeleteButton_Click()
If ListBox2.ListIndex = -1 Then Exit Sub
ListBox2.RemoveItem ListBox2.ListIndex
ListBox3.RemoveItem ListBox3.ListIndex
End Sub
merci de votre aide
3 réponses
bonjour
comment je peu controler la colonne a droite de ma colonne listbox1
merci de votre aide
Private Sub AddButton_Click()
Dim i As Integer
If ListBox1.ListIndex = -1 Then Exit Sub
For i = 0 To ListBox3.ListCount - 1
If ListBox1.Value = ListBox3.List(i) Then
Beep
Exit Sub
End If
Next i
ListBox2.AddItem ListBox1.Text
i = _
Application.WorksheetFunction.CountA(Range("A:A")) - 464
If ListBox2 = ListBox1.Text Then
Cells(i, 3) = True
End If
ListBox3.AddItem ListBox1.Value
If ListBox3 = ListBox1.Value Then
Cells(i, 3) = True
End If
End Sub
bonne journer
comment je peu controler la colonne a droite de ma colonne listbox1
merci de votre aide
Private Sub AddButton_Click()
Dim i As Integer
If ListBox1.ListIndex = -1 Then Exit Sub
For i = 0 To ListBox3.ListCount - 1
If ListBox1.Value = ListBox3.List(i) Then
Beep
Exit Sub
End If
Next i
ListBox2.AddItem ListBox1.Text
i = _
Application.WorksheetFunction.CountA(Range("A:A")) - 464
If ListBox2 = ListBox1.Text Then
Cells(i, 3) = True
End If
ListBox3.AddItem ListBox1.Value
If ListBox3 = ListBox1.Value Then
Cells(i, 3) = True
End If
End Sub
bonne journer