Show comment based on cell value

Smurfit-Stone

Active Member
Joined
Dec 1, 2004
Messages
485
Hello Board,

I need a macro to display a comment based on the result of a formula. I tried to do data validation, but it doesn't work with formulas. So I opted for conditional formatting, now I need a macro to show a comment if a cell value is less than 4, then disappear once the cell's value is changed and is greater than 4. I want to explain the conditional formatting with a comment and let the user know that the other calculation aren't working because the value is less than 4. Can anyone help? Thanks in advance.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi,

Can you incorporate it as part of the formula, e.g.
=if(formula < 4, "*** Value is less than 4 ***", formula)
 
Upvote 0
The formula is actually on another worksheet2. The cell where I need the comment to show is linked to the calculation "=sqft". I have to hide sheet2 once I'm done. All I need is a macro that show a comment if the value of a cell is less than 4 and hides the comment if the cell value is greater than 4. Please I don't need all that other stuff, just a (show if less than 4, hide if greater than 4)...Thanks!
 
Upvote 0
Hi,

Insert this Worksheet Calculate event into Sheet1 code, it assumes that the cell for the comment is A1:
Code:
Private Sub Worksheet_Calculate()
Dim rCell As Range

Set rCell = Range("A1")
On Error Resume Next
rCell.Comment.Delete
On Error GoTo 0
If rCell.Value < 4 Then rCell.AddComment ("Value less than 4")
End Sub
 
Upvote 0
Thanks so much. It work, but what I was hoping for was the comment to show automatically, not only when the cursor was placed over it. But, it works so I'll go with what I have. Thanks again, you are so helpful and kind.
 
Upvote 0

Forum statistics

Threads
1,214,948
Messages
6,122,420
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top