View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Login Name and now function

Hi,

Alt+F11 to open VB editor. Double click 'This Workbook' and paste this in on
the right. Note it uses a sheet called "Records" which you must manually
create.

Private Sub Workbook_Open()
Sheets("Records").Select
lastrow = Cells(Cells.Rows.Count, "B").End(xlUp).Row
Set myrange = Range("B1:B" & lastrow)
For Each c In myrange
If c.Value = Environ("Username") Then
c.Offset(, -1).Value = Now
ActiveWorkbook.Save
Exit Sub
End If
Next
Cells(lastrow + 1, 1).Value = Now
Cells(lastrow + 1, 2).Value = Environ("Username")
ActiveWorkbook.Save
End Sub

Mike

"saran" wrote:

Hi
We have a local intranet and some of the Excel files are shared to many users.
In a MS Excel sheet, i want to incorporate the following :
a) Login name/user name of the person and the date/time of opening the file.
b) The details should appear one by one in subsequent rows for each user
c) The details should be overwritten it is the same user opens the file later
d) The details can appear from the first row.... before the beginning of the
content of the letter

The format will look some how like this: Login Name
Date of last opening of file
A
01/01/08 11.00 AM
B
05/05/08 10.00 AM
C
07/07/08 09.00 AM

Looking for a solution..
Thanks in advance