User Name Automatically Populate

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

Is there a way to automatically populate column Z with the user name who
puts text in column A?

Thank you
 
Hi,

Right click the sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then' Change to suit
Target.Offset(0, 25).Value = Environ("UserName")
End If
End Sub

Mike
 
Use this worksheet event macro:

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("a:a")
If Intersect(Target, r) Is Nothing Then Exit Sub
Application.EnableEvents = False
Cells(Target.Row, "Z").Value = Environ("username")
Application.EnableEvents = True
End Sub
 
Thank you, worked perfectly!

Mike H said:
Hi,

Right click the sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then' Change to suit
Target.Offset(0, 25).Value = Environ("UserName")
End If
End Sub

Mike
 
Hey Mike, we just ran the survey and something strange happened.

The user names only recorded through row 10. Everthing below that did not
return an user name. Is there something in the code that could be changed?
Trying to deliver a user name whenever a person puts text into the A colum,
even if it is A20000

Thank you
 
Hey Mike, we just ran the survey and something strange happened.

A user name only returned for rows 1-10. Is there any way to change it so
that a user name returns once aperson puts somethign into column A,
regardless of how far down in the sheet we are?
 
Look at the third line in Mike's code:

If Not Intersect(Target, Range("A1:A10")) Is Nothing Then' Change to
suit

He even tells you to change it to suit (the apostrophe indicates the
start of a comment).

Hope this helps.

Pete
 
Back
Top