Bonjour tout le monde, je cherche une solution pour simplifier ce code de suppression de données.
Suppression des données de la feuille CAISSE colonne E à J
Suppression des données de la feuille JOURNAL colonne A à AP
Merci
Private Sub CommandButton5_Click()
Dim rep As Integer
rep = MsgBox("Voulez-vous supprimer l'opération du " & TextBox1, vbQuestion + vbYesNo)
If rep = vbYes Then
Sheets("CAISSE").Cells(ComboBox1.ListIndex + 4, 5).Delete Shift:=xlUp
Sheets("CAISSE").Cells(ComboBox1.ListIndex + 4, 6).Delete Shift:=xlUp
Sheets("CAISSE").Cells(ComboBox1.ListIndex + 4, 7).Delete Shift:=xlUp
Sheets("CAISSE").Cells(ComboBox1.ListIndex + 4, 8).Delete Shift:=xlUp
Sheets("CAISSE").Cells(ComboBox1.ListIndex + 4, 9).Delete Shift:=xlUp
Sheets("CAISSE").Cells(ComboBox1.ListIndex + 4, 10).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 1).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 2).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 3).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 4).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 5).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 6).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 7).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 8).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 9).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 10).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 11).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 12).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 13).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 14).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 15).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 16).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 17).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 18).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 19).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 20).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 21).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 22).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 41).Delete Shift:=xlUp
Sheets("JOURNAL").Cells(ComboBox1.ListIndex + 3, 42).Delete Shift:=xlUp
End If
End Sub