ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Create Cell Comment based on text in a cell on another worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/134922-create-cell-comment-based-text-cell-another-worksheet.html)

Dave Fellman

Create Cell Comment based on text in a cell on another worksheet
 
I have comments on all of my products stored in a separate worksheet. Is it
possible to add a comment to a product name cell that automatically links to
the text in that other worksheet? Either a direct cell reference or a table
lookup would work, but I don't see any way to put a formula into a comment.

Gary''s Student

Create Cell Comment based on text in a cell on another worksheet
 
http://www.microsoft.com/office/comm...9-bb11a6048134
--
Gary''s Student
gsnu200710


"Dave Fellman" wrote:

I have comments on all of my products stored in a separate worksheet. Is it
possible to add a comment to a product name cell that automatically links to
the text in that other worksheet? Either a direct cell reference or a table
lookup would work, but I don't see any way to put a formula into a comment.


Toppers

Create Cell Comment based on text in a cell on another worksheet
 


Try this inserted into the sheet where you enter the product name. I have
assumed products are entered in a series of cells in column A. If it only one
cell then change Target.Column = 1 to Target.Address = "$A$10" (or whatever
address is).

Right click on tab, view code and copy and paste

Table of Product and its corresponding comment are on Sheet2, columns A & B.

If no Product is found, then no comment is added.

HTH



Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim res As Variant
On Error GoTo ws_exit
Application.EnableEvents = False
Set rng = Worksheets("Sheet2").Range("A:B") '<=== Product/Comment table
in Sheet2
If Target.Column = 1 Then ' <=== Data entered in Column A
res = Application.VLookup(Target.Value, rng, 2, 0)
If Not IsError(res) Then
Target.AddComment
Target.Comment.Text Text:=res
End If
End If
ws_exit:
Application.EnableEvents = True

End Sub


"Dave Fellman" wrote:

I have comments on all of my products stored in a separate worksheet. Is it
possible to add a comment to a product name cell that automatically links to
the text in that other worksheet? Either a direct cell reference or a table
lookup would work, but I don't see any way to put a formula into a comment.



All times are GMT +1. The time now is 09:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com