Dim dat, dat_bon As Date
Dim X As Integer
Dim v As Integer
Dim Uf As Integer
Dim i As Long
Dim J As Long
Set fa = Sheets("Stock")
With Feuil1
Uf = fa.Range("A" & Rows.Count).End(xlUp).Row
For i = 0 To ListBox1.ListCount - 1
For J = 2 To Uf
If .Cells(J, 1) = Val(ListBox1.List(i, 0)) And .Cells(J, 5) = ComboBox1 Then
If Me.OptionButton1 = True Or Me.OptionButton2 = True Then
dat_bon = .Cells(J, 9)
If dat_bon < dat Then
dat_bon = dat
End If
End If
End If
Next J
Next i
For i = 0 To ListBox1.ListCount - 1
For J = 2 To Uf
If .Cells(J, 1) = Val(ListBox1.List(i, 0)) And .Cells(J, 5) = ComboBox1 And .Cells(J, 9) = dat_bon Then
If Me.OptionButton1 = True Then
.Cells(J, 4) = .Cells(J, 4) + Val(ListBox1.List(i, 3))
.Cells(J, 6) = .Cells(J, 6) - Val(ListBox1.List(i, 3))
If (Cells(J, 4).value) = 0 Then
Cells(J, 4).EntireRow.Delete
End If
ElseIf Me.OptionButton2 = True Then
.Cells(J, 4) = .Cells(J, 4) - Val(ListBox1.List(i, 3))
.Cells(J, 7) = .Cells(J, 7) + Val(ListBox1.List(i, 3))
If (Cells(J, 4).value) = 0 Then
Cells(J, 4).EntireRow.Delete
End If
End If
End If
Next J
Next i
End With
Bonsoir
Pouvez-vous m'aider?
Ce code supprime complètement la cellule 4 si la cellule contient le chiffre zéro
Mais je souhaite le fusionner avec les cellules 1 et 5, qui sont le code produit et le nom du magasin. Cependant, si le code produit et le nom du magasin ne sont pas dupliqués, la cellule ne sera pas supprimée, et cela se produit lorsque je la sélectionne. de la liste déroulante1.
Si le code produit et le nom du magasin ne sont pas dupliqués et qu'il y a un solde nul, la cellule ne sera pas supprimée
merci beaucoup