+ Reply to Thread
Results 1 to 2 of 2

Can Excel automatically update a cell with today's date when another cell is edited?

Hybrid View

  1. #1
    Registered User
    Join Date
    05-31-2010
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2003
    Posts
    1

    Smile Can Excel automatically update a cell with today's date when another cell is edited?

    hi ,

    This is my first post..i need a help with updating a cell
    Can Excel automatically update a cell with today's date when another cell is edited?
    for instance if i update/change a value in A1 from 3000 to 300 can i some one help with a formula which can update the current date and time in B1 cell which was with yesterdays date and time..

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Can Excel automatically update a cell with today's date when another cell is edit

    Private Sub Worksheet_Change(ByVal Target As Range)
    Const WS_RANGE As String = "A1"     '<== change to suit
    
        On Error GoTo ws_exit
        Application.EnableEvents = False
    
        If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
            With Target
                .Offset(0, 1).Value2 = Now
                .Offset(0, 1).NumberFormat = "dd mmm yyyy hh:mm:ss"
            End With
        End If
    
    ws_exit:
        Application.EnableEvents = True
    End Sub
    This is worksheet event code, which means that it needs to be
    placed in the appropriate worksheet code module, not a standard
    code module. To do this, right-click on the sheet tab, select
    the View Code option from the menu, and paste the code in.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1