View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Excell Add Comment

Hi Bob,

Try something like:

'=============
Public Sub Tester()
Dim rng As Range

Set rng = ActiveCell '<<==== CHANGE

If Not rng.Comment Is Nothing Then
'Existing comment, do nothing
Else
rng.Comment.Add
'Your code
End If

End Sub
'<<=============


---
Regards,
Norman



"Bob Smith" wrote in message
...
How do I check if a Cell has a comment field in VBA before I try and ADD a
comment?

e.g.

if Cells(A,1).Comment = True
Cells(A,1).Comment.Delete
Else
Cells(A,1).AddComment
Cells(A,1).Comment.Text("My Text")