log date when the file is open

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,489
Hi

I want to log the date that a file is opened. For example, If I open the file today and I entered case#2 then the date should be today date in date column but if I open this file tomorrow for case#3 then tomorrow date should be in date column at the same time case #1 and 2 date should not change.

Is there any way I can do that?

Thank you so much

Case#Date -opened
115/10/2019
211/11/2013
3

<tbody>
</tbody>
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
17,972
Office Version
2013
Platform
Windows
Paste this in the sheet module of the sheet you are working with


Code:
Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 1 Then
        If Target.Value <> "" Then
            Range("B" & Target.Row).Value = Date
        End If
    End If
End Sub
 
Last edited:

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,489
This is great. Thank you so much. It is really amazing. Could you please break it down, I mean if you can explain to me what is "Target".
Also you said to copy this code in the sheet I am working on, and I did, but my question, by doing that, does that mean this code
is running in the background of the sheet. Thank you so much for the help once again.
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
17,972
Office Version
2013
Platform
Windows
Target is the column that is being used to trigger the code in this case Column 1 or Column "A"
The code is only used by that sheet and isn't running until one of the "target" cells is used !!
 

Forum statistics

Threads
1,078,243
Messages
5,339,045
Members
399,276
Latest member
BlueCheetah

Some videos you may like

This Week's Hot Topics

Top