Forum Discussion

Griffinmon's avatar
Griffinmon
Copper Contributor
Nov 07, 2024

Creating Automated Amendment/Edited Date

Hi There All

Just wanted to see if it would be possible to create an automated amendment date on multiple sheets. There are multiple people that edit these shared documents and I would like to see when it was last edited by someone. If this is possible could you please help me out with a solution!

  • Griffinmon's avatar
    Griffinmon
    Copper Contributor

    Thank you for this, i am a serious novice with excel. is it possible to show a date on the actual sheet?

    • SnowMan55's avatar
      SnowMan55
      Bronze Contributor

      Amendment/Edit Dates (including time of day) could be captured for any Windows version of Excel (i.e., not mobile, and not Excel for the web), and presumably any Mac version of Excel since 2016 (unverified).  The dates could be captured into one place for the entire workbook, into one place (consistent or not) on specific worksheets, or even into multiple places on a worksheet (if you want to identify changes to different parts of a worksheet).  VBA is required, but the co-authoring versions of Excel (as mentioned in the article that Sergei referred to) are not required.


      But there are three big limitations/cautions to consider:

      • Only changes in cell content (the words, spaces, digits, formulas, etc.) will be detected.  Changes to cell sizes, cell borders, formatting, fill color, notes, comments, or anything else will not be detected.
      • Using this mechanism will result in some loss of functionality for that workbook: Undo and Redo features will not be available immediately after cell content is changed.  (Those features will be partially available when the change is to cell sizes, etc.)
      • Most importantly, using this mechanism requires the workbook to be stored as a macro-enabled workbook.  There are security concerns associated with macros (serious concerns!) for you and the entire business/organization.  Those concerns should be discussed with knowledgeable professionals.


      For example, opening a macro-enabled workbook from an unknown source (such as myself) must be done cautiously, and in general is not recommended.  I have placed the VBA code for the relevant event into a separate worksheet (the _Code worksheet); that way, you can open the .xlsx (non-macro enabled) workbook without fear of malware, and only install the code after you/someone review it.


      As the VBA code is short, here's a copy for your perusal:

      Private Sub Worksheet_Change(ByVal Target As Range)
      
          Const strADDR_OF_LATEST_EDIT_DATE = "$A$1"
          
          '----   Detect changes to any cell on the worksheet (except the
          '       reserved cell containing the latest date(time) of change).
          If Target.Count > 1 _
          Or Target.Address <> strADDR_OF_LATEST_EDIT_DATE Then
              Application.EnableEvents = False
              Me.Range(strADDR_OF_LATEST_EDIT_DATE).Value = Now()
              Application.EnableEvents = True
          End If
      
      End Sub

       

      Edit: forgot to attach the workbook

Resources