Results 1 to 7 of 7

Help with Date & Time Stamp (Comments)

Threaded View

  1. #1
    Registered User
    Join Date
    06-13-2013
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    14

    VBA for comments Time and Date Stamp etc. - Multiple cells in one column

    Hi,

    Apologies if the answer is somewhere already on here (being an amateur user of Excel, i'm bungling along and learning as I go!), I have the following code;

    Private Sub Worksheet_Change(ByVal Target As Range)
    With Target
    If .Address <> "$A$1" Then Exit Sub
    If IsEmpty(Target) Then Exit Sub
    Dim strNewText$, strCommentOld$, strCommentNew$
    strNewText = .Text
    If Not .Comment Is Nothing Then
    strCommentOld = .Comment.Text & Chr(10) & Chr(10)
    Else
    strCommentOld = ""
    End If
    On Error Resume Next
    .Comment.Delete
    Err.Clear
    .AddComment
    .Comment.Visible = False
    .Comment.Text Text:=strCommentOld & _
    Format(VBA.Now, "MM/DD/YYYY at h:MM AM/PM") & Chr(10) & strNewText
    .Comment.Shape.TextFrame.AutoSize = True
    End With
    End Sub

    Now, the problem is that I wish to extend the code to work in multiple cells contained within one column i.e. say from H1 to H99, but for the life of me I cannot seem to work a way to achieve the result I desire - can doctor the code and make it work in every cell in every column, but this isn't ideal as I really want to limit the operation of the "comments/date and time/changes" limited to one column, multiple cell only!.

    Many thanks for reading!

    Last edited by arlu1201; 06-17-2013 at 07:16 AM.

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