Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excell Add Comment

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")

  #2   Report Post  
Posted to microsoft.public.excel.programming
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")



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
auto locking of excell workbook (excell 2003) cheekymonkey Excel Discussion (Misc queries) 2 November 14th 08 11:50 PM
how do you open an excell email attacment, if I dont have excell Gary Excel Discussion (Misc queries) 1 February 22nd 06 10:26 PM
How can I edit a comment w/o first having to select Show Comment Mary Ann Excel Discussion (Misc queries) 1 August 26th 05 12:34 AM
How do I change the Defaults for the Excell comment box. JEN Excel Discussion (Misc queries) 2 June 2nd 05 08:43 PM
a comment plugin & copy paste directly from excel to comment ? fr. RFM Excel Worksheet Functions 0 December 1st 04 11:29 PM


All times are GMT +1. The time now is 04:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"