Got it! It's this:
cmt.Visible = True
cmt.Shape.Select
Put a tick-mark in front of those two lines; the key with the " and '
on it.
Or, use this:
Sub CommentInsertDATE()
Dim strDate As String
Dim cmt As Comment
strDate = "dd-mmm-yy hh:mm:ss"
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
Set cmt = ActiveCell.AddComment
cmt.Text Text:=Format(Now, strDate) & Chr(10)
Else
cmt.Text Text:=cmt.Text & Chr(10) _
& Format(Now, strDate) & Chr(10)
End If
End Sub
Hope it helps!
Ryan---
On Jun 15, 11:02 am, Jim <[email protected]> wrote:
> I'm a newbie. This macro is working except that it doesn't close the
> comment when it's parent cell is re-activated. Can anyone please
> help?
>
> Sub CommentInsertDATE()
> ' Keyboard Shortcut: Ctrl+Shift+D
> '
> 'adds Excel comments with date and time,
> ' positions cursor at end of comment text
> 'www.contextures.com\xlcomments03.html
>
> Dim strDate As String
> Dim cmt As Comment
>
> strDate = "dd-mmm-yy hh:mm:ss"
> Set cmt = ActiveCell.Comment
>
> If cmt Is Nothing Then
> Set cmt = ActiveCell.AddComment
> cmt.Text Text:=Format(Now, strDate) & Chr(10)
> Else
> cmt.Text Text:=cmt.Text & Chr(10) _
> & Format(Now, strDate) & Chr(10)
> End If
>
> With cmt.Shape.TextFrame
> .Characters.Font.Bold = False
> End With
>
> 'type to add comment text to selected shape
> cmt.Visible = True
> cmt.Shape.Select
>
> End Sub
--
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
To post to this group, send email to [email protected]
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!
We reach over 7000 subscribers worldwide and receive many nice notes about the
learning and support from the group.Let friends and co-workers know they can
subscribe to group at http://groups.google.com/group/excel-macros/subscribe