Results 1 to 3 of 3

Create comment and move cursor to start of comments

Threaded View

  1. #1
    Registered User
    Join Date
    04-15-2014
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 365
    Posts
    49

    Create comment and move cursor to start of comments

    Hi,
    Hoping someone could help, I could not find the answer using the search function.

    I have found code that adds a comment to a cell, and adds the text from that cell into the comment, with time and date. If a comment already exists for that cell it adds the text to the bottom of the comment.
    Which is the question, how do I make it so each time I run the macro it adds the cell text to the top of the comment.


    This is the code I have at the moment.

    Sub CommentDateTimeAdd()
    'adds Excel comments with date and time,
    '  positions cursor at end of comment text
    
    
      Dim strDate As String
        Dim cmt As Comment
       
      strDate = "dd-mmm-yy hh:mm"
    
        Set cmt = ActiveCell.Comment
      
        If cmt Is Nothing Then
          Set cmt = ActiveCell.AddComment
          cmt.Text Text:=Format(Now, strDate) & Chr(10) & ActiveCell.Value & Chr(10)
      
        Else
            cmt.Text Text:=cmt.Text & Chr(10) _
            & Format(Now, strDate) & Chr(10) & ActiveCell.Value & Chr(10)
          End If
        
        With cmt.Shape.TextFrame
          .Characters.Font.Bold = False
        End With
       End Sub
    Thanks in advance,
    Last edited by Jissenka; 12-03-2014 at 06:38 PM. Reason: Mark as Sloved

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Return cursor to start
    By Texan123 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-21-2013, 11:50 AM
  2. No clue where to start - need to move cursor relative to a found cell.
    By ExNavy91 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-07-2013, 01:18 PM
  3. Replies: 1
    Last Post: 08-26-2005, 03:05 PM
  4. Replies: 0
    Last Post: 04-30-2005, 06:06 AM
  5. Start/run a macro from wherever the cursor is??? HELP!
    By trixiebme in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-22-2005, 03:06 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