View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
bgeier
 
Posts: n/a
Default Please help a newbie with an excel vba macro relating to comments.


I inadvertantly set the last "Font.Bold" statement to true! I hate that
when that happens. It should work now.
Sorry about the inconvenience.

Sub KeyCellsChanged()
Dim strDate As String
Dim cmt As Comment
Dim Username As String
Dim lName As Long

strDate = "ddmmmyy hh:mm"
Username = application.Username
Set cmt = ActiveCell.Comment
lName = 0

If cmt Is Nothing Then
Set cmt = ActiveCell.AddComment
With cmt
.Text (Username & " " & Format(Now, strDate) & Chr(10))
.Shape.TextFrame.Characters(1, Len(Username)).Font.Bold =
True
End With
Else
Set cmt = ActiveCell.Comment
With cmt
.Shape.TextFrame.Characters(1, Len(cmt.Text)).Font.Bold =
False
.Text ("")
.Text (Username)
.Shape.TextFrame.Characters(1, Len(Username)).Font.Bold = True
.Text (cmt.Text & " " & Chr(10) & Format(Now, strDate))
.Shape.TextFrame.Characters(Len(Username) + 1, Len(strDate) +
2).Font.Bold = False
End With
End If
End Sub


--
bgeier
------------------------------------------------------------------------
bgeier's Profile: http://www.excelforum.com/member.php...o&userid=12822
View this thread: http://www.excelforum.com/showthread...hreadid=543465