C
Colin Hayes
Hi All
I use 2 macros to cover / uncover the red triangle Comment marker :
This routine cover the markers with a shape :
Sub CommentIndicatorShapes_Place()
Dim ws As Worksheet
Dim cmt As Comment
Dim rngCmt As Range
Dim shpCmt As Shape
Dim shpW As Double 'shape width
Dim shpH As Double 'shape height
Set ws = ActiveSheet
'shpW = 6
shpW = 7
'shpH = 4
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 = 22
'5=Yellow 10=Red 12=Blue 16=Brown 22=Grey 33=Pink 42=Lime 57=Green
80=White
.Fill.Visible = msoTrue
.Fill.Solid
'Put line around shape True / False
.Line.Visible = msoFalse
End With
Next cmt
End Sub
This routine removes the shapes again :
Sub CommentIndicatorShapes_Remove()
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
I've been trying to merge them into one routine , so that when it is run
it will cover the red triangles if none are present. If alternatively it
finds any present , it will uncover them. This would obviously save
having to run 2 macros , with the single merged routine covering /
uncovering as need be. Effectively , the single macro would toggle the
shapes on and off.
Can someone advise on how to merge the two?
Grateful for any advice.
I use 2 macros to cover / uncover the red triangle Comment marker :
This routine cover the markers with a shape :
Sub CommentIndicatorShapes_Place()
Dim ws As Worksheet
Dim cmt As Comment
Dim rngCmt As Range
Dim shpCmt As Shape
Dim shpW As Double 'shape width
Dim shpH As Double 'shape height
Set ws = ActiveSheet
'shpW = 6
shpW = 7
'shpH = 4
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 = 22
'5=Yellow 10=Red 12=Blue 16=Brown 22=Grey 33=Pink 42=Lime 57=Green
80=White
.Fill.Visible = msoTrue
.Fill.Solid
'Put line around shape True / False
.Line.Visible = msoFalse
End With
Next cmt
End Sub
This routine removes the shapes again :
Sub CommentIndicatorShapes_Remove()
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
I've been trying to merge them into one routine , so that when it is run
it will cover the red triangles if none are present. If alternatively it
finds any present , it will uncover them. This would obviously save
having to run 2 macros , with the single merged routine covering /
uncovering as need be. Effectively , the single macro would toggle the
shapes on and off.
Can someone advise on how to merge the two?
Grateful for any advice.