Forum Discussion
Date last modified for individual cells
To track the date when an individual cell was last modified in Excel, you can use a combination of worksheet events and VBA code.
Here is a step-by-step guide on how to achieve this:
- Open the Visual Basic for Applications (VBA) editor by pressing ALT + F11 in Excel.
- In the Project Explorer window, locate and select the worksheet where you want to track the cell modifications.
- Insert a new module by clicking on "Insert" > "Module."
- In the module, paste the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Range("A1:C100") ' Modify this range to match the range where you have your drop-down list and date columns
If Not Intersect(Target, rng) Is Nothing Then
Application.EnableEvents = False
Cells(Target.Row, "C").Value = Now ' Column C is where you want to record the last modified date
Application.EnableEvents = True
End If
End Sub
5. Replace the range "A1:C100" in the code with the actual range where your drop-down list and date columns are located. Make sure to adjust it accordingly.
6. Close the VBA editor.
Now, whenever a cell within the specified range is modified, the Worksheet_Change event will be triggered. The code will then update the corresponding cell in column C with the current date and time (using the Now function).
Note: This code assumes that your drop-down list is located in column A, and the date column where you want to track the last modified date is column C. Modify the code according to your specific range and column requirements.
Save the workbook as a macro-enabled (.xlsm) file and test it by making changes to the cells in the designated range. The date in column C should update accordingly.
Remember that macros need to be enabled for this solution to work properly.
The steps were processed with the help of AI.