pascal21
XLDnaute Barbatruc
Code:
With Sheets("tableau de bord")
Dim Cel As Range
[COLOR="Red"]For Each Cel In Range("j6:j121;m123:m238;k357:k572")[/COLOR]
With Cel
.ClearComments
If .Value > 0 And .Value <= 50 Then
With .AddComment
.Text Text:="Attention Prevoir vidange dans " & Cel & " heures"
.Visible = True
.Shape.TextFrame.AutoSize = True
End With
ElseIf .Value < 0 Then
With .AddComment
.Text Text:="Attention depassement vidange de " & Cel & " heures"
.Visible = True
With .Shape
.TextFrame.AutoSize = True
With .OLEFormat.Object
With .Font
.Name = "Arial"
.Size = 10
.ColorIndex = 3
.Bold = True
End With
End With
End With
End With
End If
End With
Next Cel
End With
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowInsertingHyperlinks:=True, AllowSorting:=True, AllowFiltering:= _
True
avec ce code dans worksheet activate j'ai un commentaire qui s'affiche sous condition
mais j'ai une erreur (ligne rouge)
quand il n'y a pas de commentaire dans la zone indiquée
comment rajouter une condition du genre
if Range("j6:j121;m123:m238;k357:k572") = pas de commentaire then exit sub
en début de code
merci