ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Capture user name (https://www.excelbanter.com/excel-programming/389806-capture-user-name.html)

Kamran

Capture user name
 
Hello,
I have this statement in macro that insert the date in a cell anytime
someone makes a change within a given row:

If Intersect(Target, Columns("G:R")) Is Nothing Then
Exit Sub
End If
n = Target.Row
Cells(n, "U").Value = Format(Now, "mm-dd-yyyy")
End Sub

I'd also like it to capture the username and input it in the same cell --
what do I need to do add to this statement to make that happen? Thanks.

Gary Keramidas

Capture user name
 
try this line

Cells(n, "U").Value = Environ("Usernme") & " " & Format(Now, "mm-dd-yyyy")

--


Gary


"Kamran" wrote in message
...
Hello,
I have this statement in macro that insert the date in a cell anytime
someone makes a change within a given row:

If Intersect(Target, Columns("G:R")) Is Nothing Then
Exit Sub
End If
n = Target.Row
Cells(n, "U").Value = Format(Now, "mm-dd-yyyy")
End Sub

I'd also like it to capture the username and input it in the same cell --
what do I need to do add to this statement to make that happen? Thanks.




Gary Keramidas

Capture user name
 
sorry had a misspelling

Cells(n, "U").Value = Environ("Username") & " " & Format(Now, "mm-dd-yyyy")

--


Gary


"Kamran" wrote in message
...
Hello,
I have this statement in macro that insert the date in a cell anytime
someone makes a change within a given row:

If Intersect(Target, Columns("G:R")) Is Nothing Then
Exit Sub
End If
n = Target.Row
Cells(n, "U").Value = Format(Now, "mm-dd-yyyy")
End Sub

I'd also like it to capture the username and input it in the same cell --
what do I need to do add to this statement to make that happen? Thanks.




Kamran

Capture user name
 
Great, that did it. Thanks.


All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com