Enregistrer date+identité utilisateur pour toute modif plage

Bonjour,

Je cherche à enregistrer sur une colone la date et l'id user pour toute modif effectuée sur une cellule dans une plage de cellules donnée.

J'ai trouvé un début de code:

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("a11:i" & [a65536].End(xlUp).Row)) Is Nothing Then

If Target.Count > 1 Then Exit Sub

Cells(Target.Row, "k") = Now

End If

End Sub

Le problème est que je ne connais pas la fonction permettant d'enregistrer l'id utilisateur (je continue mes recherches sur le sujet).

Pouvez vous m'aider sur ce point ?

En vous remerciant d'avance

EDIT:

J'ai trouvé une solution en pousuivant mes recherches:

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Target, Range("a21:i" & [a65536].End(xlUp).Row)) Is Nothing Then

If Target.Count > 1 Then Exit Sub

user = login()

Cells(Target.Row, "k") = Now & " " & user

End If

End Sub

Function login() As String

strComputer = "."

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colComputer = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")

For Each objComputer In colComputer

login = objComputer.UserName

Next

End Function

en espérant que ça pourra aider quelqu'un

Bonjour

A tester

Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Count > 1 Then Exit Sub
  If Not Application.Intersect(Target, Range("a11:i" & [a65536].End(xlUp).Row)) Is Nothing Then
    Cells(Target.Row, "k") = Now
    Cells(Target.Row, "L") = Application.UserName
  End If
End Sub

Ouai c'est plus simple ^^.

Rechercher des sujets similaires à "enregistrer date identite utilisateur toute modif plage"