Dtae du changement des cellules d'une certaine colonne en commentaire.

zia

XLDnaute Nouveau
Bonjour a toutes et tous.
Qui saurait comment faire pour que, lorsque les cellules d'une certaine colonne sont modifiees, la date de la modification apparaisse en commentaire de la cellule?



Merci par avance pour l'aide que vous m'apportez.
 

tototiti2008

XLDnaute Barbatruc
Re : Dtae du changement des cellules d'une certaine colonne en commentaire.

Re,

Oups, en effet, un petit bug...
peut-être comme ça alors ?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cellule As Range
    If Not Application.Intersect(Range("D5:D500"), Target) Is Nothing Then
        For Each Cellule In Application.Intersect(Range("D5:D500"), Target)
            If Cellule.Comment Is Nothing Then
                If Cellule.Text <> "" Then
                    Cellule.AddComment Cellule.Value & " " & Environ("username") & " " & Format(Now, "DD/MM/YYYY HH:MM:SS")
                End If
            Else
                If Cellule.Value = 0 Then
                    If Cellule.Text = "" Then
                        Cellule.Comment.Delete
                    Else
                        Cellule.Comment.Text Text:=Cellule.Value & " " & Environ("username") & " " & Format(Now, "DD/MM/YYYY HH:MM:SS")
                    End If
                Else
                    Cellule.Comment.Text Text:=Cellule.Comment.Text & Chr(10) & Cellule.Value & " " & Environ("username") & " " & Format(Now, "DD/MM/YYYY HH:MM:SS")
                End If
            End If
            On Error Resume Next
            Cellule.Comment.Shape.TextFrame.AutoSize = True
            On Error GoTo 0
        Next Cellule
    End If
End Sub
 

Discussions similaires

Statistiques des forums

Discussions
312 428
Messages
2 088 344
Membres
103 821
dernier inscrit
Lorient56