I have 70 check boxes on a sheet.
I would like each Checkbox - when clicked to fill a Rectangle around that Checkbox. If Checkbox is not clicked - the Rectangle will not be filled.
My issue is that I try to apply this code to each checkbox - but I am getting a compile error: "compile error ambiguous name detected boxcheck"
How do I prevent the compile error? Note: Each Checkbox will have it's own unique name (1-70), and each Rectangle will have its own Unique Name (1-70). This way each Checkbox should only fill the Rectangle that the VBA IF/THEN code references. I do NOT want 1 Checkbox to fill all rectangles.
Here is my code:
Sub BoxCheck()
If ActiveSheet.Shapes("Check Box 1").ControlFormat.Value = 1 Then
ActiveSheet.Shapes("Rectangle 1").Fill.ForeColor.SchemeColor = 3
End If
If ActiveSheet.Shapes("Check Box 1").ControlFormat.Value = -4146 Then
ActiveSheet.Shapes("Rectangle 1").Fill.ForeColor.SchemeColor = 1
End If
End Sub
Aucun commentaire:
Enregistrer un commentaire