1 2 3 4 5 6 7 8 9 10 11 12 13
| Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("Localisation").Select
NbLignes = ActiveSheet.UsedRange.Rows.Count
For ligne = 2 To NbLignes
If Worksheets("Localisation").Range("A" & ligne) <> "" Or Worksheets("Localisation").Range("B" & ligne) <> "" Or Worksheets("Localisation").Range("C" & ligne) <> "" Or Worksheets("Localisation").Range("D" & ligne) <> "" Or Worksheets("Localisation").Range("E" & ligne) <> "" Or Worksheets("Localisation").Range("G" & ligne) <> "" Or Worksheets("Localisation").Range("H" & ligne) <> "" Or Worksheets("Localisation").Range("I" & ligne) <> "" Or Worksheets("Localisation").Range("J" & ligne) <> "" Or Worksheets("Localisation").Range("K" & ligne) <> "" Or Worksheets("Localisation").Range("L" & ligne) <> "" Or Worksheets("Localisation").Range("M" & ligne) <> "" Or Worksheets("Localisation").Range("N" & ligne) <> "" Or Worksheets("Localisation").Range("O" & ligne) <> "" Or Worksheets("Localisation").Range("P" & ligne) <> "" _
Or Worksheets("Localisation").Range("Q" & ligne) <> "" Or Worksheets("Localisation").Range("R" & ligne) <> "" Or Worksheets("Localisation").Range("S" & ligne) <> "" Or Worksheets("Localisation").Range("T" & ligne) <> "" Or Worksheets("Localisation").Range("U" & ligne) <> "" Or Worksheets("Localisation").Range("V" & ligne) <> "" And Worksheets("Localisation").Range("F" & ligne) = "" Then
MsgBox "Libellé manquant en F" & ligne & " de l'onglet Localisation. Merci de compléter.", vbExclamation, "Message Erreur"
Cancel = True 'Annule les demandes d'enregistrement
End If
Next ligne
End Sub |
Partager