Reputation: 3
If the cell A1 contains a value of A then a checkboxA will appear. If the cell A1 contains a value of B then a checkboxB will appear. Is this possible?
Upvotes: 0
Views: 54
Reputation: 96753
Something like:
Sub ShowHide()
With ActiveSheet
Select Case Range("A1").Value
Case "A"
.Shapes("CheckboxA").Visible = True
.Shapes("CheckboxB").Visible = False
Case "B"
.Shapes("CheckboxA").Visible = False
.Shapes("CheckboxB").Visible = True
End Select
End With
End Sub
If you want this to occur automatically when A1 changes, then embed the logic in either a Calculate event macro or a Worksheet_Change macro.
For test purposes, I used this to create the boxes:
Sub Macro1()
ActiveSheet.CheckBoxes.Add(171, 18, 72, 65.25).Select
Selection.Name = "CheckboxA"
ActiveSheet.CheckBoxes.Add(180, 81, 54, 54.75).Select
Selection.Name = "CheckboxB"
End Sub
Upvotes: 2