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?
1 Answer
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
Worksheet_Changeevent Sub for that worksheet and detect any changes to your cell A1. If you get the value you're looking for, then for the checkbox in question you can toggle the visibility.Visible.