Populate User ID based on Cell value change

DKUMAR45

New Member
Joined
Feb 4, 2014
Messages
4
Hi Friends,

I have a spread sheet and multiple users are using it. I need to populate their system ID based on Cell value change or entered.

I am a new to VBA.

Can anyone help me how to write code to get and trigger the macro to get the user id in the column I want.

E.G. If there is column A to E and based on value entered or change I need his/her user ID/Log in ID populated in column F.

Thanks in advance,
DK
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi,
something like following may do what you want but be mindful that these things only work if user enables macros.

Place code in the required worksheets code page (right click tab>view code)

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rng As Range
    Set rng = Me.Columns("A:E")
    If Not Intersect(Target, rng) Is Nothing Then
        Me.Cells(Target.Row, "F").Value = Environ("USERNAME") & " - " & _
                                          Format(Now(), "dd/mm/yyyy hh:mm")
    Else
        'do nothing
    End If
End Sub

I have added a date / time stamp to end of USERNAME but you can remove if not required.

Hope helpful

Dave
 
Upvote 0
Hi,
something like following may do what you want but be mindful that these things only work if user enables macros.

Place code in the required worksheets code page (right click tab>view code)

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rng As Range
    Set rng = Me.Columns("A:E")
    If Not Intersect(Target, rng) Is Nothing Then
        Me.Cells(Target.Row, "F").Value = Environ("USERNAME") & " - " & _
                                          Format(Now(), "dd/mm/yyyy hh:mm")
    Else
        'do nothing
    End If
End Sub

I have added a date / time stamp to end of USERNAME but you can remove if not required.

Hope helpful

Dave

This is exactly I was looking for. Great Help thanks
 
Upvote 0

Forum statistics

Threads
1,223,983
Messages
6,175,778
Members
452,668
Latest member
mrider123

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