I want to change ForeColor of Rectangle2 from Green to Red which is ForeColor of Rectangle1.
So, this question is about how to change a shape color based on another shape.
Sub Macro1()
ActiveSheet.Shapes.AddShape(msoShapeRectangle, 100, 100, 100, 100).Name = "Rectangle1"
ActiveSheet.Shapes("Rectangle1").Fill.ForeColor.RGB = vbRed
ActiveSheet.Shapes.AddShape(msoShapeRectangle, 200, 200, 200, 200).Name = "Rectangle2"
ActiveSheet.Shapes("Rectangle2").Fill.ForeColor.RGB = vbGreen
'I want to change ForeColor of Rectangle2 from Green to Red which is ForeColor of Rectangle1.
'The following code need to be repaired.
ActiveSheet.Shapes("Rectangle2").ForeColor = ActiveSheet.Shapes("Rectangle1").ForeColor
End Sub
Thanks in advance.
New contributor
George Costanza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.