urbanito1
XLDnaute Occasionnel
bonsoir le forum,
ma sollicitation fait suite à la création d'un userform
https://www.excel-downloads.com/threads/userform-debutant-creation.200608/
je viens d'ajouter le code historique sur la feuille 1
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Column = 3 Or Target.Column = 4 Or Target.Column = 5 Or Target.Column = 6 Or Target.Column = 7 Then
On Error Resume Next ' active la gestion d'erreur
Err = 0
temp = Target.Comment.Text ' Commentaire existe t-il?
If Err <> 0 Then Target.AddComment ' Création commentaire
Target.Comment.Text Text:=Target.Comment.Text & _
Target.Value & " Modifié par:" & NomUtil() & _
" Le " & Now & vbLf
Target.Comment.Visible = True
Target.Comment.Shape.Select
Selection.AutoSize = True
Target.Comment.Visible = False
On Error GoTo 0 ' désactive la gestion d'erreurs
End If
Application.EnableEvents = True
End Sub
ca fonctionne
étant loin d'être un initié, je voudrais simplement avoir un avis...
est-ce bien ainsi qu'il fallait procéder?
merci bien
urbanito
ma sollicitation fait suite à la création d'un userform
https://www.excel-downloads.com/threads/userform-debutant-creation.200608/
je viens d'ajouter le code historique sur la feuille 1
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Column = 3 Or Target.Column = 4 Or Target.Column = 5 Or Target.Column = 6 Or Target.Column = 7 Then
On Error Resume Next ' active la gestion d'erreur
Err = 0
temp = Target.Comment.Text ' Commentaire existe t-il?
If Err <> 0 Then Target.AddComment ' Création commentaire
Target.Comment.Text Text:=Target.Comment.Text & _
Target.Value & " Modifié par:" & NomUtil() & _
" Le " & Now & vbLf
Target.Comment.Visible = True
Target.Comment.Shape.Select
Selection.AutoSize = True
Target.Comment.Visible = False
On Error GoTo 0 ' désactive la gestion d'erreurs
End If
Application.EnableEvents = True
End Sub
ca fonctionne
étant loin d'être un initié, je voudrais simplement avoir un avis...
est-ce bien ainsi qu'il fallait procéder?
merci bien
urbanito