Change color of single Note Indicator triangle?

jmpatrick

Active Member
Joined
Aug 17, 2016
Messages
477
Office Version
  1. 365
Platform
  1. Windows
Good morning!

I've been searching for a way to change the color of specific Note Indicators. I found this solution searching Microsoft's support site. It works fine but it changes every Note Indicator on the sheet.

I'm trying to only change the color of the Note Indicator on the selected cell. Here's the code:

VBA Code:
Sub ReformatNoteIndicator()

Dim ws As Worksheet
Dim cmt As Comment
Dim rngCmt As Range
Dim shpCmt As Shape
Dim shpW As Double
Dim shpH As Double

Set ws = ActiveSheet
shpW = 5
shpH = 5

For Each cmt In ws.Comments
  Set rngCmt = cmt.Parent
  With rngCmt
    Set shpCmt = ws.Shapes.AddShape(msoShapeRightTriangle, rngCmt.Offset(0, 1).Left - shpW, .Top, shpW, shpH)
  End With
  With shpCmt
    .Flip msoFlipVertical
    .Flip msoFlipHorizontal
    .Fill.ForeColor.SchemeColor = 12
    .Fill.Visible = msoTrue
    .Fill.Solid
    .Line.Visible = msoFalse
  End With
Next cmt

End Sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I'm trying to only change the color of the Note Indicator on the selected cell.
Try this modification of that code.

VBA Code:
Sub Test()
  Dim shpCmt As Shape
  Dim shpW As Double
  Dim shpH As Double

  shpW = 5
  shpH = 5

  With ActiveCell
    If Not .Comment Is Nothing Then
      Set shpCmt = .Parent.Shapes.AddShape(msoShapeRightTriangle, .Offset(0, 1).Left - shpW, .Top, shpW, shpH)
      With shpCmt
        .Flip msoFlipVertical
        .Flip msoFlipHorizontal
        .Fill.ForeColor.SchemeColor = 12
        .Fill.Visible = msoTrue
        .Fill.Solid
        .Line.Visible = msoFalse
      End With
    End If
  End With
End Sub
 
Upvote 1
Solution
Try this modification of that code.

VBA Code:
Sub Test()
  Dim shpCmt As Shape
  Dim shpW As Double
  Dim shpH As Double

  shpW = 5
  shpH = 5

  With ActiveCell
    If Not .Comment Is Nothing Then
      Set shpCmt = .Parent.Shapes.AddShape(msoShapeRightTriangle, .Offset(0, 1).Left - shpW, .Top, shpW, shpH)
      With shpCmt
        .Flip msoFlipVertical
        .Flip msoFlipHorizontal
        .Fill.ForeColor.SchemeColor = 12
        .Fill.Visible = msoTrue
        .Fill.Solid
        .Line.Visible = msoFalse
      End With
    End If
  End With
End Sub

Perfect! Thanks so much.
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0
You're welcome. Thanks for the follow-up. :)

Let me know if this requires a new post. Is it possible to delete the shape in the active cell? Similar to this (which deletes every shape):

VBA Code:
Sub RemoveIndicatorShapes()

Dim ws As Worksheet
Dim shp As Shape

Set ws = ActiveSheet

For Each shp In ws.Shapes
If Not shp.TopLeftCell.Comment Is Nothing Then
  If shp.AutoShapeType = _
    msoShapeRightTriangle Then
    shp.Delete
  End If
End If
Next shp
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,325
Messages
6,124,254
Members
449,149
Latest member
mwdbActuary

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