+ Reply to Thread
Results 1 to 4 of 4

keep track of changes in the cells as comments in the affected cell.

  1. #1
    Registered User
    Join Date
    05-19-2014
    MS-Off Ver
    Excel 2003
    Posts
    12

    keep track of changes in the cells as comments in the affected cell.

    Hi There , I have this VBS which I found online which keep track of changes in the cells as comments in the affected cell.


    Option Explicit

    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim x As Variant, y As Variant

    If Target.Count > 1 Then Exit Sub

    Application.EnableEvents = False

    x = Target.Value

    Application.Undo

    y = Target.Value

    Target.Value = x

    Application.EnableEvents = True

    Target.NoteText Text:=Target.NoteText & Chr(10) & "Old value " & y _

    & " changed to " & x & " on " & Format(Date, "mm-dd-yyyy") _

    & " by " & Environ("username")

    Target.Comment.Shape.AutoShapeType = msoShapeRoundedRectangle

    Target.Comment.Shape.TextFrame.AutoSize = True

    End Sub




    But I will need to use it only for column T (Date value) to register changes in dates of these columns/Cells, great if someone can help
    Last edited by srvgonzalez; 07-07-2015 at 10:31 AM.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: keep track of changes in the cells as comments in the affected cell.

    To get an answer to your thread, you must, first, comply with rule #3 about putting lines of code under CODE TAG.
    Select your code above and click on CTRL+X to cut them out. Then click on the # icon above this text window and click on
    CTRL+V to copy it again within the code tags.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    05-19-2014
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: keep track of changes in the cells as comments in the affected cell.

    Option Explicit

    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim x As Variant, y As Variant

    If Target.Count > 1 Then Exit Sub

    Application.EnableEvents = False

    x = Target.Value

    Application.Undo

    y = Target.Value

    Target.Value = x

    Application.EnableEvents = True

    Target.NoteText Text:=Target.NoteText & Chr(10) & "Old value " & y _

    & " changed to " & x & " on " & Format(Date, "mm-dd-yyyy") _

    & " by " & Environ("username")

    Target.Comment.Shape.AutoShapeType = msoShapeRoundedRectangle

    Target.Comment.Shape.TextFrame.AutoSize = True

    End Sub

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: keep track of changes in the cells as comments in the affected cell.

    Here is rule #3 :
    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button). The result will appear like this in the post window:

    and here is what it will look like when published.

    Please Login or Register  to view this content.
    And you have your anwser in the above code.
    Hope this helps
    Last edited by p24leclerc; 07-07-2015 at 01:20 PM.

+ 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. Replies: 1
    Last Post: 02-11-2015, 01:27 PM
  2. Need a macro to extract track changes and comments from Word to Excel
    By serene11111 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2014, 06:35 PM
  3. Replies: 3
    Last Post: 09-24-2012, 08:32 AM
  4. Locking & Protecting Cells Affected by Macro
    By tahira in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-17-2008, 11:36 AM
  5. Help required in the Macro for extracting the track changes and comments
    By karthunairh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2005, 06:05 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