• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Checkbox To Control Shape Fill - VBA Code


New Member
I used macro recorder to get code that will fill the shapes I want with the color I want. However, I am struggling with how to get it to trigger with a checkbox. I need the code below to activate when the box is checked, but then reverse when the box is unchecked.

Sub ShapeFill()


' ShapeFill Macro



ActiveSheet.Shapes.Range(Array("Rectangle 1")).Select

ActiveSheet.Shapes.Range(Array("Rectangle 1", "Rectangle 61")).Select

ActiveSheet.Shapes.Range(Array("Rectangle 1", "Rectangle 61", "Rectangle 62" _


With Selection.ShapeRange.Fill

.Visible = msoTrue

.ForeColor.ObjectThemeColor = msoThemeColorBackground1

.ForeColor.TintAndShade = 0

.ForeColor.Brightness = 0

.Transparency = 0


End With

End Sub