Date and Username log history

ahs004

Board Regular
Joined
Jul 18, 2011
Messages
83
Hi all,

I have a spreadsheet which keeps a log of project status and its used by six project managers.

I have created a tab called Log history.

What i want is to keep a log of computer name and time everytime it is saved.

I have had a go but not there and seek pro help.

I can send the file over if anyone want to have a go but here is the vba
Code:
Private Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
  As Long
  
Function UserName() As String
'   Returns the name of the logged-in user
    Dim Buffer As String * 100
    Dim BuffLen As Long
    BuffLen = 100
    GetUserName Buffer, BuffLen
    UserName = Left(Buffer, BuffLen - 1)
End Function
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Anextrow As Long
Dim Bnextrow As Long
Anextrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
Bnextrow = Cells(Rows.Count, "B").End(xlUp).Row + 1
If Target.Cells.Count > 1 Then Exit Sub
        If Not Intersect(Target, Range("A5:J200")) Is Nothing Then
                With Range("a" & Anextrow).Select
                ActiveCell = Now
                 Range("B" & Bnextrow).Select
                 ActiveCell = UserName
                
                End With
        End If
End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,222,398
Messages
6,165,770
Members
451,986
Latest member
samwize

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