T
ThierryR
Guest
Bonjour à tous,
J'ai deux listbox SuiviBP (3 colonnes) et RapprochementBP (5 colonnes). Je prends un élément de SuiviBP et je le mets dans RapprochementBP. Jusque là tout marche mais je voudrai transférer SuiviBP dans les 3ères colonnes de RapprochementBP : la cela coince... 🙂 une ligne à la suite de l'autre après chaque drag and drop.
Voici mon bout de programme inspiré maladroitement selon l'exemple de @Thierry USF_Drag_N_Drop_To_Cells.xls :
Private Sub RapprochementBP_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
Dim Ligne As Integer
Cancel = True
Effect = 1
If SuiviBP.ListCount >= 1 Then
If SuiviBP.ListIndex = -1 Then
SuiviBP.ListIndex = SuiviBP.ListCount - 1
End If
Ligne = RapprochementBP.ListCount + 1
With RapprochementBP
.AddItem SuiviBP.Column(0, SuiviBP.ListIndex)
.Column(1, 0) = SuiviBP.Column(1, (SuiviBP.ListIndex))
.Column(2, 0) = SuiviBP.Column(2, (SuiviBP.ListIndex))
.Column(3, 0) = SuiviBP.Column(3, (SuiviBP.ListIndex))
End With
End If
End Sub
Merci d'avance pour votre aide
ThierryR
J'ai deux listbox SuiviBP (3 colonnes) et RapprochementBP (5 colonnes). Je prends un élément de SuiviBP et je le mets dans RapprochementBP. Jusque là tout marche mais je voudrai transférer SuiviBP dans les 3ères colonnes de RapprochementBP : la cela coince... 🙂 une ligne à la suite de l'autre après chaque drag and drop.
Voici mon bout de programme inspiré maladroitement selon l'exemple de @Thierry USF_Drag_N_Drop_To_Cells.xls :
Private Sub RapprochementBP_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As MSForms.fmAction, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
Dim Ligne As Integer
Cancel = True
Effect = 1
If SuiviBP.ListCount >= 1 Then
If SuiviBP.ListIndex = -1 Then
SuiviBP.ListIndex = SuiviBP.ListCount - 1
End If
Ligne = RapprochementBP.ListCount + 1
With RapprochementBP
.AddItem SuiviBP.Column(0, SuiviBP.ListIndex)
.Column(1, 0) = SuiviBP.Column(1, (SuiviBP.ListIndex))
.Column(2, 0) = SuiviBP.Column(2, (SuiviBP.ListIndex))
.Column(3, 0) = SuiviBP.Column(3, (SuiviBP.ListIndex))
End With
End If
End Sub
Merci d'avance pour votre aide
ThierryR