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
|
Private Sub Worksheet_Deactivate()
nbVides Range("A1:C10")
End Sub
Sub nbVides(zone As Range)
Dim Cel As Range
For Each Cel In zone
If Not IsNumeric(Cel) Or Cel < 0 Or Cel = "" Then
Bordure Cel, True
MsgBox "Saisie non valide en cellule " & Cel.Address(0, 0) & " !"
Me.Activate
Exit For
Else
Bordure Cel, False
End If
Next
End Sub
Sub Bordure(Cel As Range, Colorer As Boolean)
Dim I As Integer
For I = 7 To 10
With Cel.Borders(I)
.Weight = IIf(Colorer = True, 4, 1)
.LineStyle = IIf(Colorer = True, 1, xlNone)
.ColorIndex = IIf(Colorer = True, 3, xlNone)
End With
Next I
End Sub |
Partager