View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Formatting a comment by code

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim strTemp As Date

If Target.Cells.Count 1 Then
Exit Sub
End If

If Intersect(Target, Me.Range("A:A")) Is Nothing Then
Exit Sub
End If

strTemp = Date

With Target.Offset(0, 2)
If .Comment Is Nothing Then
'do nothing
Else
.Comment.Delete
End If

.AddComment Application.UserName & " - AoS due by: " _
& Format(strTemp, "dd/mm/yy")

.Comment.Shape.TextFrame _
.Characters(Len(.Comment.Text) - 7, 8).Font.Bold = True

End With

End Sub
Jock wrote:

How can I apply bold formatting to the date part of the following code?
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(strTemp, "dd/mm/yy")
--
Traa Dy Liooar

Jock


--

Dave Peterson