Auto fill date when row changes

lilgreen

New Member
Joined
May 10, 2019
Messages
15
Hello,

I am trying to find a way for an automatic date stamp to be populated into a field (Col J) in a row when any other cell contained within the same row is changed or modified.

[FONT=Helvetica, Arial, Verdana, sans-serif]I know this is easy just haven't figured it out[/FONT]
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Are they being changed manually or by formula?

If manually, right-click on the Sheet tab name at the bottom of the screen, select View Code, and paste this VBA code in the resuling VB Editor window.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim cell As Range
    
    Application.ScreenUpdating = False
    
    For Each cell In Target
        Application.EnableEvents = False
        Cells(cell.Row, "J") = Now()
        Application.EnableEvents = True
    Next cell
    
    Application.ScreenUpdating = True
    
End Sub
This should do what you want.
 
Last edited:
Upvote 0
This works perfectly. The only thing I see that could be a problem, I just now thought of it, is if I make any changes to any header it is going to change the header I have for that column to the date changed. I should have thought of it.
 
Upvote 0
What rows are you headers in?
We can explicitly exclude certain rows, if you like.
 
Upvote 0
This should do it:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim cell As Range
    
    Application.ScreenUpdating = False
    
    For Each cell In Target
        Application.EnableEvents = False
        [COLOR=#ff0000]If cell.Row > 1 Then [/COLOR]Cells(cell.Row, "J") = Now()
        Application.EnableEvents = True
    Next cell
    
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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