Bonjour,
Je rencontre un problème avec un code qui me permet d'alimenter et de supprimer des lignes d'une feuille excel à l'aide d'une listbox dans un userform.
le problème apparait lorsuque je n'ai plus qu'une ligne dans ma list box si je rentre une nouvelle ligne ou je retire une ligne un beug apparait avec cette commande : ListBox3.List() = [nom].Value
voila si quelqu'un peut m'aider cela serait génial! Merci!!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Private Sub CommandButton8_Click() Dim j As Integer Dim numero As Integer For i = 0 To ListBox2.ListCount - 1 If ListBox2.Selected(i) = True Then With Feuil2 .Rows(i + 2).Copy End With With Feuil4 .Rows(1).Insert Shift:=xlDown End With End If Next i For i = 0 To ListBox2.ListCount - 1 'décoche toutes les cases 'sélection de l'item ListBox2.Selected(i) = False Next i With Feuil4 numero = 1 For j = 1 To [nombre_charges] .Cells(j, 1) = numero numero = numero + 1 Next End With ListBox3.List() = [nom].Value MsgBox ("Ces charges ont bien été ajoutées au BILAN") End Sub
Partager