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 50 51 52 53
| Private Sub Worksheet_Change(ByVal Target As Range) 'proposition gFZT82
Dim comment As String
Dim tempo As Date
Application.EnableEvents = False
If Target.Count <> 1 Or (Not Application.Intersect(Target, Range("C9:L100")) Is Nothing _
And Range("A" & Target.Row) = "") Then
Application.Undo
ActiveSheet.UnProtect Password:="****"
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 200, 150, 170.25, 91.5).Select
Selection.Characters.Text = "Impossible ! Il n'y a pas de nom sur cette ligne !"
DoEvents
With Selection.Characters(start:=1, Length:=50).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 15
.Shadow = True
.ColorIndex = 5 '(bleu)
With Selection
.ShapeRange.Fill.ForeColor.SchemeColor = 13
.Name = "leTxt"
.AutoSize = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
End With
tempo = Time
Do While Time < tempo + TimeSerial(0, 0, 2) '(2 sec.)
Loop
ActiveSheet.Shapes("leTxt").Delete
'Application.ScreenUpdating = False
comment = "Impossible ! Il n'y a pas de NOM pour cette ligne !"
DoEvents
With ActiveSheet
.Protect Password:="****", userinterfaceonly:=True
.Protect _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True
.EnableSelection = xlUnlockedCells
End With
End If
Application.EnableEvents = True
End Sub |
Partager