Re: Adding a variable value to a comment?
- From: Dave Peterson <petersod@xxxxxxxxxxxxxxxx>
- Date: Thu, 09 Mar 2006 11:50:50 -0600
How about just plopping that value directly into the comment:
Option Explicit
Sub testme01()
With ActiveCell
If .Comment Is Nothing Then
'do nothing
Else
.Comment.Delete
End If
.AddComment Text:=CStr(.Value + .Offset(0, -3).Value)
.Comment.Visible = True
End With
End Sub
Tom wrote:
How can I add a variable value to a comment?
I want to create a comment that is based on a simple math function.
The comment tag would display the sum of the current cell plus that of one
other.
Here is what I have so far:
-----------------------
dim holdval, commentval
holdval = ActiveCell.Value
ActiveCell.ForumlaR1C1 = "=RC[0]+RC[-3]"
ActiveCell.AddComment
ActiveCell.Comment.Visible = True
commentval = ActiveCell.Value
ActiveCell.Comment.Text = commentval
ActiveCell.Value = holdval
ActiveCell.Select
---------------------------
Line 7 is where I'm getting all the problems. The error I get is "Assignment
to constant is not permitted". I've also tried this line:
ActiveCell.Comment.Text Text:= commentval
in which case I get an application error.
Am I just trying to do something that is impossible or is there another way
to get a variable value into a comment?
Thanks!
--
Dave Peterson
.
- Follow-Ups:
- Re: Adding a variable value to a comment?
- From: bhofsetz
- Re: Adding a variable value to a comment?
- Prev by Date: Re: EXCEL file corruption
- Next by Date: Disable cell warning/error messages
- Previous by thread: Re: Adding a variable value to a comment?
- Next by thread: Re: Adding a variable value to a comment?
- Index(es):
Relevant Pages
|