Thread: cell comment
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Jack Sons Jack Sons is offline
external usenet poster
 
Posts: 144
Default cell comment

Bob,

I tried, but it halts at the line
If ActiveCell.Comment.Text < "" Then
with the error message "object variable or block variable With is not set"
(I translated from Dutch, sounds a bit clumsy I'm afraid).
What now?

Jack.

"Bob holmes" <Bob schreef in bericht
...
I was able to use the following code to do what you want (this had to be
run
as a standard macro, though, putting in a Event procedure causes it to
loop
and produce unwanted resuts).

Sub AddComment()
Dim Commentval As Double
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If ActiveCell.Comment.Text < "" Then
Commentval = CDbl(cmt.Text)
ActiveCell.Value = ActiveCell.Value + Commentval
Commentval = ActiveCell.Value
ActiveCell.Comment.Text CStr(Commentval)
End If
End Sub

"Tim Williams" wrote:

You could set up a procedure using the worksheet change event.
Get the comment text (do you want to automatically add one if there isn't
one there?) and use cint() or similar to convert it to a number.
Add the current value of the cell to that, and set the comment text to
cstr(sum_of_numbers)

tim.



--
Tim Williams
Palo Alto, CA


"Jack Sons" wrote in message
...
Anonymous,

To my regret I found nothing on work done to comments regarding
numbers.

You or anybody else got a solution?

Jack.

schreef in bericht
...
hi,
not sure if this will help but Debra Dalgleish's site has
some code on comments. i haven't been there in a while but
you might try it.
http://www.contextures.com/xlcomments03.html


-----Original Message-----
Hi all,

A1 has a cell comment containing a number, say, 5 (or is
content of a
comment "text" by default?)
If I enter a value (number) in A1 (say 7) I want after
the entry the cell
content to be the sum of the original content (5) and the
entry in A1, so
after that in A1 is 7 and in the cell comment is 12.

I tried all kinds of things, succeeded in putting cell
content in comment,
also adding cell comment to cell content, but not what I
described above
(adding cell content to comment).

Your help will be appreciated.

Jack Sons
The Netherlands


.