Time-stamping existing data with date created

coco5280

New Member
Joined
Jul 8, 2021
Messages
7
Office Version
  1. 365
Platform
  1. MacOS
Hello!

I have stumbled on this community and man, do I have a problem that I can not solve by myself! I have a spreadsheet in which I have data in columns A-F that I add to regularly. I recently wanted to update it so that I have a timestamp of when each cell in column A was entered. The issue that I am running into is that I have 150+ rows in which I do not know when the data was added. I have been messing around in VBA to figure out how to do this and from researching online, it seems that it might be impossible. BUT, I found this community and felt that it might be worth a shot to ask since the other articles were from 5+ years ago and there seems to be people who are far more experienced than me.

I want to be able to populate a timestamp in every row of column G that gives the date in which the data in column A of the corresponding row was added (NOT modified). I want this to be a date that does not change if there is ever any modification to the cell.

Please let me know if it is possible to generate this for existing data! Any help is greatly appreciated.

Cheers!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Have a try with these macros to be placed in the sheet's vbe module; if I correctly understood your request they should do the job. Feel free to adjust whatever doesn't apply ;).
VBA Code:
Option Explicit
Dim CellValue  As Variant

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub       'exit if multicell selection    
    CellValue = Target.Value                      'detect original value
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub       'exit if multicell selection
    If Target.Column <> 1 Then Exit Sub           'exit if not column A
    If Target.Value = "" And CellValue = "" Then Exit Sub 'exit if I cancel an empty cell
    Application.EnableEvents = False
    If CellValue = "" Then Target.Offset(0, 6).Value = Now() 'if activecell was empty add time-stamp in columnn G
    CellValue = vbNullString                      'reset variable to detect cancel/change of same cell
    Application.EnableEvents = True
End Sub
 
Upvote 0
Solution
If you're asking about existing data, no, there is no way to know when it was entered
 
Upvote 0
Have a try with these macros to be placed in the sheet's vbe module; if I correctly understood your request they should do the job. Feel free to adjust whatever doesn't apply ;).
VBA Code:
Option Explicit
Dim CellValue  As Variant

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub       'exit if multicell selection   
    CellValue = Target.Value                      'detect original value
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub       'exit if multicell selection
    If Target.Column <> 1 Then Exit Sub           'exit if not column A
    If Target.Value = "" And CellValue = "" Then Exit Sub 'exit if I cancel an empty cell
    Application.EnableEvents = False
    If CellValue = "" Then Target.Offset(0, 6).Value = Now() 'if activecell was empty add time-stamp in columnn G
    CellValue = vbNullString                      'reset variable to detect cancel/change of same cell
    Application.EnableEvents = True
End Sub
That works for me!! It appears that others are not able to generate the date when they enter something into column A. Is there a way to have this work for all users and not just me?
 
Upvote 0
There are no limitations for different users.
If you are managing the file as a shared file then there could be limitations on multi-access.
Are you sure that other user have activated the use of macros in their Excel ?
 
Upvote 0
There are no limitations for different users.
If you are managing the file as a shared file then there could be limitations on multi-access.
Are you sure that other user have activated the use of macros in their Excel ?
I am sharing the file. I will check with them that they are allowing macros
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,593
Members
452,654
Latest member
mememe101

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