+ Reply to Thread
Results 1 to 9 of 9

datestamp a specific column when a cell is modified

Hybrid View

Robso datestamp a specific column... 06-30-2015, 08:16 AM
berlan Re: datestamp a specific... 06-30-2015, 08:19 AM
JOHN H. DAVIS Re: datestamp a specific... 06-30-2015, 08:56 AM
Robso Re: datestamp a specific... 06-30-2015, 11:14 AM
Robso Re: datestamp a specific... 08-07-2015, 12:13 PM
JOHN H. DAVIS Re: datestamp a specific... 08-07-2015, 02:23 PM
ladynana17 Re: datestamp a specific... 08-18-2015, 05:46 AM
zbor Re: datestamp a specific... 08-18-2015, 06:02 AM
ladynana17 Re: datestamp a specific... 08-18-2015, 06:13 AM
  1. #1
    Registered User
    Join Date
    06-30-2015
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007
    Posts
    3

    Red face datestamp a specific column when a cell is modified

    Hello all,

    I'm stretching my abilities slightly here so please forgive me if I'm asking a stupid question.

    I'm looking to input a time/ date stamp on a spreadsheet when anybody modifies a cell. I have found a code that works almost perfectly.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
    If Not Intersect(Target, Range("A:H")) Is Nothing Then
    Application.EnableEvents = False
    Target.Offset(, 1) = Format(Now, "dd/mm/yyyy hh:mm")
    Application.EnableEvents = True
    End If
    End Sub

    This is where I ask the stupid question, how do I get the date/ time stamp to appear in column I only as opposed to offset 1 cell over from where the change has been made.
    I've had a look around and tried some other solutions, all of which appear to offset the timestamp rather than populating a predefined column.

    Any help/ suggestions would be appreciated. Thanks in advance for your help.

  2. #2
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: datestamp a specific column when a cell is modified

    Try changing:
    Target.Offset(, 1) = Format(Now, "dd/mm/yyyy hh:mm")
    to
    Intersect(Target.EntireRow, Columns("I")) = Format(Now, "dd/mm/yyyy hh:mm")

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: datestamp a specific column when a cell is modified

    Change:

    Target.Offset(, 1) = Format(Now, "dd/mm/yyyy hh:mm")
    To:

    Cells(Target.Row, "I") = Format(Now, "dd/mm/yyyy hh:mm")

  4. #4
    Registered User
    Join Date
    06-30-2015
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007
    Posts
    3

    Re: datestamp a specific column when a cell is modified

    Thank you both.

    Both solutions work perfectly.

  5. #5
    Registered User
    Join Date
    06-30-2015
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007
    Posts
    3

    Re: datestamp a specific column when a cell is modified

    I have returned again!

    I'm looking to add to the above date stamp code by including the user who modified the cell. I'm trying this (below) but with no joy. Any help would be greatly appreciated.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
    If Target.Address = "$A$1" Then
    Application.EnableEvents = False
    Target.Offset(, 1) = Format(Now, "dd/mm/yyyy hh:mm")
    Target.Offset(, 2) = Environ("USERNAME")
    Application.EnableEvents = True
    End If
    End Sub

    I'm afraid I haven't learned much since the last time asked so please excuse me if I'm making obvious errors. "Every days a learning day"

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: datestamp a specific column when a cell is modified

    What's not happening that you want too happen? It seems to work for me.

  7. #7
    Registered User
    Join Date
    08-18-2015
    Location
    SG
    MS-Off Ver
    2007
    Posts
    4

    Re: datestamp a specific column when a cell is modified

    Hi,

    I'm doing the same for the date time stamp and updated by username. But I got an additional question.

    (1) I got a row which is the header but I do not want the formula to run on this header if I made changes to it. How do I tweak this codes?

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
    If Not Intersect(Target, Range("A:X")) Is Nothing Then
    Application.EnableEvents = False
    Intersect(Target.EntireRow, Columns("Y")) = Now()
    Intersect(Target.EntireRow, Columns("X")) = Environ("USERNAME")
    Application.EnableEvents = True
    End If
    End Sub

    (2) If I insert a row, the system will prompt debug. How do I overcome this?

    Your expertise in this is greatly appreciated.
    Thank you.

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,069

    Re: datestamp a specific column when a cell is modified

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Never use Merged Cells in Excel

  9. #9
    Registered User
    Join Date
    08-18-2015
    Location
    SG
    MS-Off Ver
    2007
    Posts
    4

    Re: datestamp a specific column when a cell is modified

    thank you for the reply.

+ 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. Automatic Datestamp once Conditions met in Cell
    By DUrekew in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-10-2013, 10:18 AM
  2. [SOLVED] Datestamp in cell that never changes
    By minifreak in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-11-2012, 01:12 AM
  3. Get last modified time in cell for specific value
    By kents86 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2011, 07:55 AM
  4. Datestamp an adjacent cell & not allow later alteration
    By Glio in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-09-2008, 09:03 AM
  5. datestamp a comment into a cell
    By excelwannabe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2006, 11:00 PM

Tags for this Thread

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