log date when the file is open

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
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

[TABLE="class: grid, width: 400"]
<tbody>[TR]
[TD]Case#[/TD]
[TD]Date -opened[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]15/10/2019[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]11/11/2013[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Thank you for your reply. I am entering them manually. Thanks
 
Upvote 0
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:
Upvote 0
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.
 
Upvote 0
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 !!
 
Upvote 0

Forum statistics

Threads
1,223,625
Messages
6,173,395
Members
452,514
Latest member
cjkelly15

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