Setting GroupName Property for OptionButtons in VBA Macro code

Dear Experts,

I currently am writing a macro in Excel to create a trio of Option Buttons which are located next to a cell which contains the name of one of my companies products.  The buttons will allow the user the opportunity to select a particular form of the product he wants. I have created this macro already for 30 products in a particular worksheet.  I went into each of the buttons and linked them to a certain cell (LinkedCell Property) and I gave each trio of buttons the same groupname (GroupName property).

Now I am doing a new version of the program which will cover 400 products.  I am trying to write a macro which will create the buttons, link them to a certain cell, and assign a group name to each trio.

Using a For Each loop and the Copy method, I have been able to create the trio of buttons.  The problem is that I am unable to assign a GroupName to each trio of buttons.  I get an 438 error that says Object doesn't support this Property or Method.

Can you show me what code I need to assign a GroupName and LinkedCell property to the new buttons I have created?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The type of Option Button you are using is the VB style.  The Excel style doesn't have a GroupName (it relies on group boxes around the option buttons to show what goes with what)

You access VB ones as follows ...

ActiveSheet.OLEObjects("Test").Object.GroupName = "Test2"

ActiveSheet.OLEObjects("Test").LinkedCell = "Sheet1!A1"

Note the .Object in the Groupname one.
"Test" was the name of my Option Button btw

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.