Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default cell comment

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default cell comment

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


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default cell comment

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


.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default cell comment

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


.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default cell comment

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


.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default cell comment

When used in an event procedure you could do this:

application.enableevents=false
'do your update
application.enableevents=true

But make sure if there's any error in the code you re-enable event handling
in the error handler.


A slightly better approach (I think) is to use a procedure-level flag to
prevent "reentry"


sub object_event()

static bInProgress as boolean

if bInProgress then exit sub

bInProgress = true
'do stuff which might trigger object_event
bInProgress = false

end sub

This way you're not interfering with other events you might still want to
fire.

Tim.

--
Tim Williams
Palo Alto, CA


"Bob holmes" <Bob wrote in message
...
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


.








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


.








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default cell comment

Tanks Tim,

But see my response to Bobs answer.

Jack.

"Tim Williams" <saxifrax at pacbell dot net schreef in bericht
...
When used in an event procedure you could do this:

application.enableevents=false
'do your update
application.enableevents=true

But make sure if there's any error in the code you re-enable event
handling
in the error handler.


A slightly better approach (I think) is to use a procedure-level flag to
prevent "reentry"


sub object_event()

static bInProgress as boolean

if bInProgress then exit sub

bInProgress = true
'do stuff which might trigger object_event
bInProgress = false

end sub

This way you're not interfering with other events you might still want to
fire.

Tim.

--
Tim Williams
Palo Alto, CA


"Bob holmes" <Bob wrote in message
...
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


.










  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default cell comment

Most likely the cell does not have a comment. You'll have to catch the
error and create one.

Dim cmt As Comment

on error resume next
Set cmt = ActiveCell.Comment
on error goto 0

if cmt is nothing then
'add a comment with "0" as text
Set cmt = ActiveCell.AddComment(Text:="0")
end if
'etc.....

--
Tim Williams
Palo Alto, CA


"Jack Sons" wrote in message
...
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


.










  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default cell comment

Tim,

The code below works, but I want it to be executed automatically when a cell
gets a new entry. So if I click on the cell with in its comment the number
12 and then click key 5 of the number part of the keybord and after that of
course "enter", then I want this procedure to be executed (which means after
execution the cell shows the number 5 and the comment shows 17. I suppose it
will be a kind of _Change procedure, but I don't now what it should be.
Please show me the way.

Jack.

Sub AddComment()
Dim Commentval As Double
Dim cmt As Comment

On Error Resume Next
Set cmt = ActiveCell.Comment
On Error GoTo 0

If cmt Is Nothing Then
'add a comment with "0" as text
Set cmt = ActiveCell.AddComment(Text:="0")
End If

NewEntry = ActiveCell.Value

If ActiveCell.Comment.Text < "" Then
Commentval = CDbl(cmt.Text)
ActiveCell.Value = ActiveCell.Value + Commentval
Commentval = ActiveCell.Value
ActiveCell.Comment.Text CStr(Commentval)
End If

ActiveCell.Value = NewEntry

End Sub

"Tim Williams" <saxifrax at pacbell dot net schreef in bericht
...
Most likely the cell does not have a comment. You'll have to catch the
error and create one.

Dim cmt As Comment

on error resume next
Set cmt = ActiveCell.Comment
on error goto 0

if cmt is nothing then
'add a comment with "0" as text
Set cmt = ActiveCell.AddComment(Text:="0")
end if
'etc.....

--
Tim Williams
Palo Alto, CA


"Jack Sons" wrote in message
...
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


.














  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default cell comment

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

Dim cmt As Comment

If Target.Cells.Count 1 Then Exit Sub

On Error Resume Next
Set cmt = Target.Comment
On Error GoTo 0

If cmt Is Nothing Then
Set cmt = Target.AddComment(Text:="0")
End If

If cmt.Text < "" Then
cmt.Text CStr(Target.Value + CDbl(cmt.Text))
End If

End Sub

--
Tim Williams
Palo Alto, CA


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

The code below works, but I want it to be executed automatically when a

cell
gets a new entry. So if I click on the cell with in its comment the number
12 and then click key 5 of the number part of the keybord and after that

of
course "enter", then I want this procedure to be executed (which means

after
execution the cell shows the number 5 and the comment shows 17. I suppose

it
will be a kind of _Change procedure, but I don't now what it should be.
Please show me the way.

Jack.

Sub AddComment()
Dim Commentval As Double
Dim cmt As Comment

On Error Resume Next
Set cmt = ActiveCell.Comment
On Error GoTo 0

If cmt Is Nothing Then
'add a comment with "0" as text
Set cmt = ActiveCell.AddComment(Text:="0")
End If

NewEntry = ActiveCell.Value

If ActiveCell.Comment.Text < "" Then
Commentval = CDbl(cmt.Text)
ActiveCell.Value = ActiveCell.Value + Commentval
Commentval = ActiveCell.Value
ActiveCell.Comment.Text CStr(Commentval)
End If

ActiveCell.Value = NewEntry

End Sub

"Tim Williams" <saxifrax at pacbell dot net schreef in bericht
...
Most likely the cell does not have a comment. You'll have to catch the
error and create one.

Dim cmt As Comment

on error resume next
Set cmt = ActiveCell.Comment
on error goto 0

if cmt is nothing then
'add a comment with "0" as text
Set cmt = ActiveCell.AddComment(Text:="0")
end if
'etc.....

--
Tim Williams
Palo Alto, CA


"Jack Sons" wrote in message
...
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


.














  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default cell comment

Tim,

That is it, thank you very much.

Jack.

"Tim Williams" <saxifrax at pacbell dot net schreef in bericht
...
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

Dim cmt As Comment

If Target.Cells.Count 1 Then Exit Sub

On Error Resume Next
Set cmt = Target.Comment
On Error GoTo 0

If cmt Is Nothing Then
Set cmt = Target.AddComment(Text:="0")
End If

If cmt.Text < "" Then
cmt.Text CStr(Target.Value + CDbl(cmt.Text))
End If

End Sub

--
Tim Williams
Palo Alto, CA


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

The code below works, but I want it to be executed automatically when a

cell
gets a new entry. So if I click on the cell with in its comment the
number
12 and then click key 5 of the number part of the keybord and after that

of
course "enter", then I want this procedure to be executed (which means

after
execution the cell shows the number 5 and the comment shows 17. I suppose

it
will be a kind of _Change procedure, but I don't now what it should be.
Please show me the way.

Jack.

Sub AddComment()
Dim Commentval As Double
Dim cmt As Comment

On Error Resume Next
Set cmt = ActiveCell.Comment
On Error GoTo 0

If cmt Is Nothing Then
'add a comment with "0" as text
Set cmt = ActiveCell.AddComment(Text:="0")
End If

NewEntry = ActiveCell.Value

If ActiveCell.Comment.Text < "" Then
Commentval = CDbl(cmt.Text)
ActiveCell.Value = ActiveCell.Value + Commentval
Commentval = ActiveCell.Value
ActiveCell.Comment.Text CStr(Commentval)
End If

ActiveCell.Value = NewEntry

End Sub

"Tim Williams" <saxifrax at pacbell dot net schreef in bericht
...
Most likely the cell does not have a comment. You'll have to catch the
error and create one.

Dim cmt As Comment

on error resume next
Set cmt = ActiveCell.Comment
on error goto 0

if cmt is nothing then
'add a comment with "0" as text
Set cmt = ActiveCell.AddComment(Text:="0")
end if
'etc.....

--
Tim Williams
Palo Alto, CA


"Jack Sons" wrote in message
...
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


.
















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
Can insert digital ink into Excel cell or a cell comment? Nickbray Excel Discussion (Misc queries) 1 June 2nd 10 03:53 AM
copy comment content to cell content as data not as comment Lilach Excel Discussion (Misc queries) 2 June 21st 07 12:28 PM
Create Cell Comment based on text in a cell on another worksheet Dave Fellman Excel Discussion (Misc queries) 2 March 15th 07 09:49 AM
I want to change comment printing cell 3 to whats in cell 3 Lonny and Rinda Excel Worksheet Functions 3 June 19th 06 08:36 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 05:26 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"