0

I create an OptionButton with

For Each c In Selection
    Dim right As Range
    Set right = c.Offset(0, 1)
    Button = ActiveSheet.OptionButtons.Add(c.Left, c.Top, c.Width, c.Height)
    With Button
        .LinkedCell = right.Address   ' has no effect
        .Characters.Text = ""
        .Name = right.Address
    End With
Next

I want to change the LinkedCell of the newly created button, but the With block doesn't have an effect.

What am I doing wrong?

1 Answer 1

1

When you add a control, the function returns an Object which has to be Set to a variable.

Try: Set Button = ActiveSheet.OptionButtons.Add(c.Left, c.Top, c.Width, c.Height)

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.