Bonjour,
J'ai une listeBox dans une feuille qui prend des données.
Je ne passe pas par un USERFORM.
Mais je ne peut copier les données.
Mon fichier est protégé contre la sauvegarde.
Voici le code qui rempli la listeBox
Sub TextBox2_Change()
Dim Search As Range, Ligne As Byte
ListBox6.Clear:
If TextBox2 = "" Then Exit Sub
With Worksheets("Caisse-Borne")
For Ligne = 2 To 210
'If .Cells(Ligne, 9) Like TextBox1 & "*" Then
If .Cells(Ligne, 9) Like TextBox2 Then
ListBox6.AddItem .Cells(Ligne, 8)
'ListBox6.List(ListBox6.ListCount - 1, 1) = Ligne
OffAction = False
End If
Next Ligne
End With
End Sub
Le code pour copier
Public Function fSendTextToClipboard(strToSend As String) As Boolean ' APPEL DE LA FONCTION PRESSE PAPIER
Dim dObj As Object
Set dObj = New DataObject
With dObj
.SetText strToSend
.PutInClipboard
End With
Set dObj = Nothing
End Function
' Le bouton Copier
Sub CommandButton2_Click()
fSendTextToClipboard (ListBox6.Text)
End Sub
J 'ai lu les autres demandes, mais je suis un peu perdu.
Merci