VBA UserForm ListBox boucle

Fermé
bobtipitt - 22 mars 2008 à 18:13
bobtipitt Messages postés 61 Date d'inscription dimanche 23 mars 2008 Statut Membre Dernière intervention 16 août 2010 - 23 mars 2008 à 16:29
Bonjour,
Comment on fais pour faire une boucle qui va changer de ligne dans un listbox.
Voici le code.

Private Sub CommandButton1_Click()

Unload UserForm6
Load UserForm7
UserForm7.Show
End Sub

Private Sub CommandButton2_Click()
Unload UserForm6
Range("B12").Select
Selection.ClearContents
End Sub

Private Sub CommandButton3_Click()
Unload UserForm6
End Sub

Private Sub CommandButton4_Click()
With Me.ListBox1
For I = 0 To .ListCount - 1
If .Selected(I) = True Then
y = y + 1
Range("G12:G35" & y).Value = .List(I)
End If
Next I
End With
End Sub

Private Sub ListBox1_Click()

End Sub

Private Sub TabStrip1_Change()
Load UserForm7
End Sub


Regarder a Commandebutton4

3 réponses

bonjour

Private Sub CommandButton4_Click()
dim l as integer
l=Me.ListBox1.ListCount - 1

For I = 0 To l
If Me.ListBox1.Selected(I) = True Then
y = y + 1
Range("G12:G35" & y).Value = Me.ListBox1.List(I)
End If
Next I

End Sub
1
Dacore mais moi ces le controleSource de la listbox que je veux changer, ma condition est: si il n'y a pas quelque chose d'écrit sur la ligne.... ("B12:B35")
1
bobtipitt Messages postés 61 Date d'inscription dimanche 23 mars 2008 Statut Membre Dernière intervention 16 août 2010 2
23 mars 2008 à 16:29
Bonjour faites vite pour repondre a cette question et je me suis decider a me creer un compte
0