Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Add a DateStamp in Excel

Excel How To

How to Add a DateStamp in Excel

by  SkipVought  Posted    (Edited  )
You cannot do this with a spreadsheet function, since it would recalculate each time you recalculated, resulting in the current date.

You will need to use the Worksheet_Change event.

1. Alt+F11 activates the VB editor

2. In the Project Explorer, right click the sheet object that you want the date stamp on.

3. In the Object drop down box (in the upper, L-H corner of code window) select Worksheet

4. In the Procedure window (in the upper, R-H corner of code window) select Change

5. Now code for column G changing and putting the DateStamp in column F (modify for your specific situation)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim Cell As Range
    For Each Cell In Target
        With Cell
            If .Column = Range("G:G").Column Then
                Cells(.Row, "F").Value = Int(Now)
            End If
        End With
    Next Cell
End Sub
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top