Excel UDF : Dependent cell comment

Best Online Course : SAS Programming with 50+ Case Studies

- Explain Programming Concepts in Simple English
- Live Projects & Case Studies
- Job Placement Assistance
- Get 10% off till Sep 11, 2017
- Batch starts from October 8, 2017

Suppose you want to populate cell comment based on information from another cell. As a value changes, text specified in comment also changes automatically. There is no such excel function which populates cell comment. I developed a user defined function (UDF) that takes a cell reference and populates a comment.
Function Addcomment(rng As Range, str As String) As String
    If Not rng.Comment Is Nothing Then rng.Comment.Delete
    If Len(str) Then rng.Addcomment.Text str
    rng.Comment.Visible = True
End Function

How to Use :
1. Press ALT + F11 to open Visual Basic Editor
2. In visual basic editor window, Go to Insert >> Module
3. In module, add the above lines of code.
4. In main excel window, type
  =Addcomment(cell reference where you are entering this formula, cell reference of another cell )

Example :
A value is in cell B2 . In cell C2, type =Addcomment(C2,B2). 

Excel Tutorials : 100 Excel Tutorials

About Author:

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has close to 7 years of experience in data science and predictive modeling. During his tenure, he has worked with global clients in various domains like retail and commercial banking, Telecom, HR and Automotive.

While I love having friends who agree, I only learn from those who don't.

Let's Get Connected: Email | LinkedIn

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

0 Response to "Excel UDF : Dependent cell comment"

Post a Comment

Next → ← Prev