Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Populate cell and cell comment

Posted on 2014-03-13
6
Medium Priority
?
395 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
Independent Software Vendors: 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

636 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