+ Reply to Thread
Results 1 to 5 of 5

VBA for Timestamp

Hybrid View

ercedwards VBA for Timestamp 11-30-2013, 02:29 AM
madAlchemist Re: VBA for Timestamp 11-30-2013, 03:03 AM
MarvinP Re: VBA for Timestamp 11-30-2013, 03:11 AM
ercedwards Re: VBA for Timestamp 11-30-2013, 10:31 AM
alansidman Re: VBA for Timestamp 11-30-2013, 10:39 AM
  1. #1
    Registered User
    Join Date
    07-05-2011
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    2

    VBA for Timestamp

    I want to put a timestamp NOW() in cell J2 ONLY when a user changes the value in cells C1:I1 (these are merged cells)

    Any ideas?

    Thanks much

  2. #2
    Registered User
    Join Date
    11-29-2013
    Location
    GDL, MX
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA for Timestamp

    use the worksheet_change event:

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not (Intersect(Target, ActiveSheet.Range("c1:i1")) Is Nothing) Then
            Application.EnableEvents = False
                ActiveSheet.Range("j2") = Now()
            Application.EnableEvents = True
        End If
    End Sub

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,355

    Re: VBA for Timestamp

    Hi ercedwards and welcome to the forum,

    This takes event code that is behind the worksheet itself, not in a module. The code looks like this:
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("C1:I1")) Is Nothing Then
            Cells(1, "J") = Time
        End If
    End Sub
    This is a starter as you will most likely want to build on the above. Here is also the workbook to try it out.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    07-05-2011
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: VBA for Timestamp

    Thanks ever so much. It works perfectly.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: VBA for Timestamp

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Timestamp for any changes in row from A:S
    By ld2x07 in forum Excel General
    Replies: 7
    Last Post: 06-14-2013, 11:20 AM
  2. Timestamp
    By preciouslife73 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2012, 07:20 PM
  3. TimeStamp
    By AAKASH JAIN in forum Excel General
    Replies: 7
    Last Post: 12-29-2011, 03:19 AM
  4. When a timestamp doesn't behave as a timestamp
    By mredekopp in forum Excel General
    Replies: 3
    Last Post: 03-07-2011, 03:39 PM
  5. is there a way to timestamp
    By 173 in forum Excel General
    Replies: 2
    Last Post: 12-28-2008, 03:45 AM

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