Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VBA Visual Basic for Applications (Microsoft) FAQ

Excel How To

How to Add a DateStamp in Excel by SkipVought
Posted: 19 Mar 02

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)

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

Back to VBA Visual Basic for Applications (Microsoft) FAQ Index
Back to VBA Visual Basic for Applications (Microsoft) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close