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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
Private Sub Supprimer_étape()
Dim ligne As Long
Dim Num_étape As Integer
'Récupération de la ligne de la case selectionnée
ligne = ActiveCell.Row
Num_étape = Feuil6.Cells(10, 9).Value
If ligne < 12 Then
MsgBox ("Sélectionnez une ligne dans le corps du test.")
ElseIf Num_étape = 0 Then
MsgBox ("Il n' y a pas d'étapes à supprimer.")
ElseIf ligne > 11 + Num_étape Then
MsgBox ("Sélectionnez une ligne dans le corps du test.")
Else
'Suppresion de la ligne
Feuil6.Rows(ligne).Delete xlShiftDown
Num_étape = Num_étape - 1
Feuil6.Cells(10, 9).Value = Num_étape
If ligne = 12 Then
Feuil6.Cells(ligne, 1).Value = 1
For i = ligne To Num_étape + 11
If Feuil6.Cells(i, 1).Value = "" Then
Exit For
Else
Feuil6.Cells(i + 1, 1).Value = Feuil6.Cells(i, 1).Value + 1
Feuil6.Cells(Num_étape + 12, 1).Value = Num_étape
End If
Next i
Else
For i = ligne To Num_étape + 11
If Feuil6.Cells(i, 1).Value = "" Then
Exit For
Else
Feuil6.Cells(i, 1).Value = Feuil6.Cells(i - 1, 1).Value + 1
Feuil6.Cells(Num_étape + 12, 1).Value = Num_étape
End If
Next i
End If
End If
End Sub |
Partager