Pull computer username into cell based on another cell value...

lozfromcorby

Board Regular
Joined
Oct 12, 2010
Messages
60
Hello,

I have a log that gets updated by various people throughout the day.

Is there a way that as soon as the user fills in a cell, say B11, that it stamps B12 automatically with the logged on computer user?

Cheers if anyone can help, if its possible!

Lawrence Ferguson
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Perhaps a macro that pulls the username to a hidden cell? then a circular formula so that B12 refers to that cell when B11 is not blank?

If thats the case, I just need VB on pulling a Username to a cell?!

Just thinking out loud, someone please help!

Kindest Regards,

Lawrence Ferguson
 
Upvote 0
Is it a particluar row or column you'd need to update?

Right click on the sheet tab, choose 'view code' from the menu and paste this code in.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$B$11" Then
        Application.EnableEvents = False
        Range("B12").Value = Application.UserName
        Application.EnableEvents = True
    End If
End Sub
If you need something more general, post back with the parameters.
 
Upvote 0
This will log in column C when an entry is made in column B. Right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then
    Application.EnableEvents = False
    Target.Offset(, 1).Value = Environ("username")
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0
Helo again,

thank you for both replies! IT works how I want now, and I've learnt a little more on the ways to get it done, so thanks very much!

Lawrence Ferguson
 
Upvote 0

Forum statistics

Threads
1,215,526
Messages
6,125,328
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top