How to Dynamically change the Background Color of a Comment

NJR

New member
Joined
Jun 26, 2014
Messages
11
Reaction score
0
Points
0
Excel Version(s)
2010
I am looking to dynamically change the color of Comments (not Manually change the color).

  • I’m using excel 2010 on Windows 7.
  • The cells in Column C use Conditional Formatting to change the background color of the cell to either Red, Yellow, Blue or Green – based on data in other Columns. This coloring is my status indicator for each Row of data.
  • Each cell in Column C also has a Comment.

I would like to have the BG color of the Comment always change to match the BG color of the Cell in which the comment resides. I can do it manually – but would like to have the colors match-up automatically without the need to go into each Comment to change the color to match the current color Status of the Cells in Column C.

My excel experience is basic so I’m not sure whether this can be done via Conditional Formatting, Macros, or other methods….

Any advice is much appreciated....
 
I don't think this can be done with conditional formats, but I have the beginnings of a solution with a macro which would include something like:
Code:
For Each cll In Columns(3).SpecialCells(xlCellTypeAllFormatConditions).Cells
  If Not cll.Comment Is Nothing Then
    cll.Comment.Shape.Fill.ForeColor.RGB = cll.DisplayFormat.Interior.Color
  End If
Next cll
but where this would go depends on how the values in column C are getting there (are they calculated?, put in manually?, cut and pasted in)?
If you put the above code into a macro :
Code:
Sub blah()
For Each cll In Columns(8).SpecialCells(xlCellTypeAllFormatConditions).Cells
  If Not cll.Comment Is Nothing Then
    cll.Comment.Shape.Fill.ForeColor.RGB = cll.DisplayFormat.Interior.Color
  End If
Next cll
End Sub
and just run it, it will run through each cell in column C which has conditional formatting in, check it has a comment, then match the colour of the comment to the visible colour of the cell. It will work on the sheet which is currently active.
So the outstanding questions to you are:
How do these cells change their values? (via a formula or manual input)
When do you want the comment colour to match?
 
Hi p45cal - That worked like a charm... on the first try...! The only edit was to switch Column(8) to Column(3) to match the column I was working with.

I was not changing the actual Values in the Column - only the BG color was changing - so the code above was perfect.

Thanks so much p45cal for the assistance. I know where to go the next time I'm looking for help to answer an exel question... :cool:
 
Back
Top