Re: Comment value from cell content

Giganews Newsgroups
Subject: Re: Comment value from cell content
Posted by:  Rick Rothstein \(MVP - VB\) (rick.newsNO.SP…@NO.SPAMverizon.net)
Date: Thu, 17 Jul 2008

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" <colinbainbridg…@googlemail.com> wrote in message
news:fd9e5e75-5532-402a-ba34-6e4797f3f9…@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.

Replies

In response to

Comment value from cell content posted by Creamegg on Thu, 17 Jul 2008