Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Excel

Comment value from cell content

 
Jump to:  
 
Creamegg
PostPosted: Thu Jul 17, 2008 2:06 pm    Post subject: Comment value from cell content
       
I would like to populate a comment with a value taken from a different
cell. Is there a simple way to reference a cell within a comment?

I am a fairly basic user with very limited knowledge of Visual Basic.
 

 
Rick Rothstein (MVP - VB)
PostPosted: Thu Jul 17, 2008 3:23 pm    Post subject: Re: Comment value from cell content
       
You can do what you want using the worksheet's Change event. Give this a
try... right-click the tab for the worksheet with the cell whose value you
want to incorporate in the comment (this is not the cell where the comment
will be placed; rather, the cell whose value you want to retrieve), click on
View Code from the popup menu that appears and copy/paste the following in
the code window that appeared...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$1" Then
With Worksheets("Sheet1").Range("A1")
.ClearComments
.AddComment "Cell B1 now contains " & Target.Value
End With
End If
End Sub

For example purposes, the above code assumes the cell whose value you want
to monitor (and whose value you want to display in the comment) is B1 and
the cell where the comment will be placed is A1.

Now, whenever you change B1 on that worksheet, the comment in A1 will change
to show the new value in B1 as part of its text.

Rick


"Creamegg" <colinbainbridge1@googlemail.com> wrote in message
news:fd9e5e75-5532-402a-ba34-6e4797f3f9c8@2g2000hsn.googlegroups.com...
Quote:
I would like to populate a comment with a value taken from a different
cell. Is there a simple way to reference a cell within a comment?

I am a fairly basic user with very limited knowledge of Visual Basic.
 

 
Dave Peterson
PostPosted: Thu Jul 17, 2008 3:27 pm    Post subject: Re: Comment value from cell content
       
You could use a macro to do this.

But in my experience, life is simpler if I use an adjacent cell and just plop
the info into that. Then I can sort/filter or do whatever I want to those
cells.

Creamegg wrote:
Quote:

I would like to populate a comment with a value taken from a different
cell. Is there a simple way to reference a cell within a comment?

I am a fairly basic user with very limited knowledge of Visual Basic.

--

Dave Peterson
 

 
Creamegg
PostPosted: Thu Jul 17, 2008 8:35 pm    Post subject: Re: Comment value from cell content
       
Thanks for your help. It's just what I needed.

- Creamegg


On Jul 17, 6:23 pm, "Rick Rothstein \(MVP - VB\)"
<rick.newsNO.S...@NO.SPAMverizon.net> wrote:
Quote:
You can do what you want using the worksheet's Change event. Give this a
try... right-click the tab for the worksheet with the cell whose value you
want to incorporate in the comment (this is not the cell where the comment
will be placed; rather, the cell whose value you want to retrieve), click on
View Code from the popup menu that appears and copy/paste the following in
the code window that appeared...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$1" Then
With Worksheets("Sheet1").Range("A1")
.ClearComments
.AddComment "Cell B1 now contains " & Target.Value
End With
End If
End Sub

For example purposes, the above code assumes the cell whose value you want
to monitor (and whose value you want to display in the comment) is B1 and
the cell where the comment will be placed is A1.

Now, whenever you change B1 on that worksheet, the comment in A1 will change
to show the new value in B1 as part of its text.

Rick

"Creamegg" <colinbainbrid...@googlemail.com> wrote in message

news:fd9e5e75-5532-402a-ba34-6e4797f3f9c8@2g2000hsn.googlegroups.com...

I would like to populate a comment with a value taken from a different
cell. Is there a simple way to reference a cell within a comment?

I am a fairly basic user with very limited knowledge of Visual Basic.
 

 
Dave Mills
PostPosted: Fri Jul 18, 2008 3:56 am    Post subject: Re: Comment value from cell content
       
If you want to do this on a range of cells then set up a named range, e.g.
"CommentArea" for the cells that need to comments. Then change the use the next
two lines instead of the "If Target.Address = "$B$1" Then" to run only is the
changed cell on any one of those within the named range.

You don't need a named range but it makes it easier to read and easier to change
the range scope without needing to change the code.

Set isect = Application.Intersect(Target, Range("CommentArea"))
If Not (isect Is Nothing) Then

On Thu, 17 Jul 2008 13:23:41 -0400, "Rick Rothstein \(MVP - VB\)"
<rick.newsNO.SPAM@NO.SPAMverizon.net> wrote:

Quote:
You can do what you want using the worksheet's Change event. Give this a
try... right-click the tab for the worksheet with the cell whose value you
want to incorporate in the comment (this is not the cell where the comment
will be placed; rather, the cell whose value you want to retrieve), click on
View Code from the popup menu that appears and copy/paste the following in
the code window that appeared...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$1" Then
With Worksheets("Sheet1").Range("A1")
.ClearComments
.AddComment "Cell B1 now contains " & Target.Value
End With
End If
End Sub

For example purposes, the above code assumes the cell whose value you want
to monitor (and whose value you want to display in the comment) is B1 and
the cell where the comment will be placed is A1.

Now, whenever you change B1 on that worksheet, the comment in A1 will change
to show the new value in B1 as part of its text.

Rick


"Creamegg" <colinbainbridge1@googlemail.com> wrote in message
news:fd9e5e75-5532-402a-ba34-6e4797f3f9c8@2g2000hsn.googlegroups.com...
I would like to populate a comment with a value taken from a different
cell. Is there a simple way to reference a cell within a comment?

I am a fairly basic user with very limited knowledge of Visual Basic.
--

Dave Mills
There are 10 type of people, those that understand binary and those that don't.
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

gratka hotele na rodos wywoływanie zdjęć przekształcenie spółki city