0

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
  • Yes, it's possible.We can help you more easily if you show the code you're working with. In general though, create code in the Worksheet_Change event 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. Commented May 3, 2018 at 16:52

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.