Identifiantet historique
Bonjour,
Je souhaiterais mettre en place l'historique de saisie de modification or j'ai un problèmes avec ce code
Bonjour,
Je souhaiterais mettre en place l'historique de saisie de modification en utilisant ce code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
For i = 3 To 34
Application.EnableEvents = False
If Target.Column = i And Target.Count = 1 Then ' colonne 3 seulement
If Target.Comment Is Nothing Then Target.AddComment ' Création commentaire
Target.Comment.Text Text:=Target.Comment.Text & _
Format(Target.Value, "# ##0.00 €") & " Modifié par:" & Environ("UserName") & _
" Le " & Now & vbLf
Target.Comment.Shape.TextFrame.AutoSize = True
End If
Next i
Application.EnableEvents = True
End Subau lieu de "Environ("UserName") " il faudrait que le programme aille chercher l'identifiant tapé dans mon première userform (qui permet à l'utilisateur de voir que les onglets qui le concerne)
PS: identifiant: ADMIN
mot de passe : ADMIN
Bonjour,
je souhaiterais rectifié ma question vu que mon fichier à un peu changé
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
For i = 3 To 34
Application.EnableEvents = False
If Target.Column = i And Target.Count = 1 Then ' colonne 3 seulement
If Target.Comment Is Nothing Then Target.AddComment ' Création commentaire
Target.Comment.Text Text:=Target.Comment.Text & _
Format(Target.Value, "# ##0.00 €") & " Modifié par:" & Environ("UserName") & _
" Le " & Now & vbLf
Target.Comment.Shape.TextFrame.AutoSize = True
End If
Next i
Application.EnableEvents = True
End SubIl faudrait remplacer Environ("UserName") par l'identifiant référencé dans la case "B2" de ma page d'accueil (Feuil2)
Salut, essaie ça
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
For i = 3 To 34
Application.EnableEvents = False
If Target.Column = i And Target.Count = 1 Then ' colonne 3 seulement
If Target.Comment Is Nothing Then Target.AddComment ' Création commentaire
Target.Comment.Text Text:=Target.Comment.Text & _
Format(Target.Value, "# ##0.00 €") & " Modifié par:" & Worksheets("Feuil2").Range("B2") & _
" Le " & Now & vbLf
Target.Comment.Shape.TextFrame.AutoSize = True
End If
Next i
Application.EnableEvents = True
End SubEDIT : N'oublie pas de renseigner ta cellule B2 de ta feuille "Feuil2" qui est actuellement vide... Ou alors tu parlais de la cellule B1 ?
Merci beaucoup pour ta rapidité de réponse, et oui je voulais dire B1