Keep the track of persons how opened the sheet and made changes.

H

Heera

Hi,

I have a workbook and 6 of us have access to the workbook.

I want to write a code so that i can come to know how many people
opened the file and made the changes.

I need the following information on a separate sheet.

1. Lan Id (Name of the person who log's in.)
2. Date
3. Time
4. Changes made and saved (Yes/No)

I know very basic level of scripting it is too difficult for me.

Regards

Heera
 
B

Barb Reinhardt

Forgot to paste the code.

Option Explicit

Private Sub Workbook_Open()
'1. Lan Id (Name of the person who log's in.)
'2. Date
'3. Time
'4. Changes made and saved (Yes/No)
'Create a worksheet for the log.
'Set the worksheet codename to "LOG"
Dim lRow As Long

If Logsheet Is Nothing Then
MsgBox ("You have no worksheet with the codename logsheet in your
workbook")
Exit Sub
End If

lRow = Logsheet.Cells(Logsheet.Rows.Count, 1).End(xlUp).Row + 1

If lRow = 2 Then
With Logsheet
.Cells(1, 1).Value = "User Name"
.Cells(1, 2).Value = "Date"
.Cells(1, 3).Value = "Time"
.Cells(1, 4).Value = "Changes Made"
End With
End If

Logsheet.Cells(lRow, 1).Value = Environ("USERNAME")
With Logsheet.Cells(lRow, 2)
.Value = Date
.NumberFormat = "mm/dd/yyyy"
End With
With Logsheet.Cells(lRow, 3)
.Value = Time
.NumberFormat = "h:mm AM/PM"
End With

Logsheet.Cells(lRow, 4).Value = "Changes Made"

End Sub
 
B

Barb Reinhardt

Here's the first part. Put this in the ThisWorkbook Module. You'll need to
create a new worksheet and make the worksheet codename LOGSHEET. From the
worksheet tab, right click to VIEW CODE.

Select the worksheet of interest
Change the name here to LOGSHEET.

Maybe someone else can help with the second part.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top