Bonsoir,
Je cherche à simplifier ce code qui efface des cellules à partir d'un userform
Merci
Private Sub CommandButton2_Click()
Dim rep As Integer
rep = MsgBox("Voulez-vous supprimer le code analytique " & TextBox1 & " " & TextBox2, vbQuestion + vbYesNo)
If rep = vbYes Then
SdA.Cells(LI, 1).ClearContents
SdA.Cells(LI, 2).ClearContents
SdA.Cells(LI, 3).ClearContents
SdA.Cells(LI, 4).ClearContents
SdA.Cells(LI, 5).ClearContents
SdA.Cells(LI, 6).ClearContents
SdA.Cells(LI, 7).ClearContents
SdA.Cells(LI, 8).ClearContents
SdA.Cells(LI, 17).ClearContents
SdA.Cells(LI, 18).ClearContents
SdA.Cells(LI, 19).ClearContents
SdA.Cells(LI, 20).ClearContents
SdA.Cells(LI, 21).ClearContents
SdA.Cells(LI, 22).ClearContents
SdA.Cells(LI, 23).ClearContents
SdA.Cells(LI, 24).ClearContents
SdA.Cells(LI, 25).ClearContents
SdA.Cells(LI, 26).ClearContents
SdA.Cells(LI, 27).ClearContents
End If
End Sub