Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Knowing if a comment was added. (XL2000)

3 views
Skip to first unread message

samuelmarin

unread,
Nov 17, 2001, 5:02:36 AM11/17/01
to
Hi.
I need to know if cell bears a comment without having to handle errors.
The perfect code I'm dreaming of would look like :

if range("A1").hascomment = True then
Code...
endif

Does anyone know a turn around ?
Many thx.
Sam.

samue...@wanadoo.fr
http://perso.wanadoo.fr/sam.marie


Patrick Molloy

unread,
Nov 17, 2001, 6:13:35 AM11/17/01
to
Use a UDF (User Defined Functio) eg

Function HasComment(Target As Range) As Boolean
On Error Resume Next
Dim txt As String
txt = Target.Comment.Text
HasComment = Err.Number = 0
Err.Clear
End Function

then in your code

If HasComment(Ranhe("A1") then
...code


--
Patrick Molloy
Microsoft Excel MVP


"samuelmarin" <samue...@wanadoo.fr> wrote in message
news:9t5c6a$1hf$1...@wanadoo.fr...

Eddy Dockx

unread,
Nov 25, 2001, 9:24:25 AM11/25/01
to
Hi,

You can check if a cell contains a comment as follows :

Sub HasComment()
If Not Range("A1").NoteText = "" Then
Code ...
End If
End Sub

Regards
Eddy


"samuelmarin" <samue...@wanadoo.fr> schreef in bericht
news:9t5c6a$1hf$1...@wanadoo.fr...

0 new messages