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
| Sub Delete_Lot()
Application.ScreenUpdating = False
Dim i, j As Integer
Dim N As Integer
N = ActiveSheet.Cells(1, 3).Value + 3
i = ActiveCell.Row
j = ActiveCell.Column
If ActiveSheet.Cells(i, 3).Value <> VIDE And i > 3 Then
If ActiveSheet.Cells(i, 2).Value = "N" Then
X = MsgBox("Confirmez-vous la suppression du lot " & ActiveSheet.Cells(i, 3).Value, vbYesNo)
If X = 6 Then
Deverrouillage
If ActiveSheet.Name = "Liste PETRI" Then
ActiveSheet.Range("A" & i & ":F" & i & ", H" & i & ":H" & i & ", J" & i & ":S" & i & ", U" & i & ":AD" & i & ", AF" & i & ":AO" & i & ", AQ" & i & ":AZ" & i & ", BB" & i & ":BV" & i).ClearContents
Range("A4:BV" & N).Select
Selection.Sort Key1:=Range("B4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End If
If ActiveSheet.Name = "Liste T&F" Then
ActiveSheet.Range("A" & i & ":G" & i & ", I" & i & ":I" & i & ", K" & i & ":W" & i & ", Y" & i & ":AI" & i & ", AK" & i & ":AU" & i & ", AW" & i & ":BG" & i & ", BI" & i & ":CD" & i).ClearContents
Range("A4:CD" & N).Select
Selection.Sort Key1:=Range("B4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End If
Verrouillage
ThisWorkbook.Save
Cells(i, j).Select
End If
Else
X = MsgBox("Vous n'êtes pas autorisé à supprimer un lot entré en Autoqualité", vbExclamation)
End If
End If
End Sub |
Partager