?
Solved

Populate cell and cell comment

Posted on 2014-03-13
6
Medium Priority
?
384 Views
Last Modified: 2014-03-14
Hello. Is it possible to populate the cell comment from VLOOKUP? The VLOOKUP in the sample file attached works fine, but some of the text is too much for the cell. Also the cell populated from the VLOOKUP does not have to be printable hence my reasoning of trying to populate it as a comment rather. Thanks
Book2-SAMPLEv2.xls
0
Comment
Question by:zerog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Author Comment

by:zerog
ID: 39925948
Been trying this. It adds the comment, but it doesn't show the text "Check comment" in Q2. Also how would I do this for a range as there are many rows and it's messy to execute a macro for every row manually one at a time. Thanks

Sub testcomment()
    [Q2].AddComment
    [Q2].Comment.Text "Check comment" & Format([M2])
End Sub

Open in new window

0
 

Author Comment

by:zerog
ID: 39926374
Found this piece of code on the internet. It's more advanced than the one quoted in my earlier post. It populates the comment for a specific cell. How do I get it to show some text e.g. "Check Comment" in the cell to guide the user so that they know they have to click to view the comment.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

   Dim Cell As Range

   If Intersect([M2:M10], Target) Is Nothing Then
      On Error Resume Next
      For Each Cell In [M2:M10]
         Cell.Comment.Delete
      Next Cell
   Else
      For Each Cell In Intersect([M2:M10], Target)
         If Len(Me.Cells(Cell.Row, "O").Value) > 0 Then
            On Error Resume Next
            Cell.Comment.Delete
            On Error GoTo 0
            Cell.AddComment Me.Cells(Cell.Row, "O").Value
         End If
      Next Cell
   End If

End Sub

Open in new window

0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39927895
Sub testcomment()
    [Q2].AddComment
    [Q2].Comment.Text "This is the comment" & Format([M2])
    [Q2].Value = "Check comment"
End Sub

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:zerog
ID: 39927946
Thank you for your response. Is there a way I can add that to work in the advanced piece of code I posted?
0
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 39927953
Between lines 16 and 17 add

Cell.Value = "Check comment"
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39929579
I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2013
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question