• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1403
  • Last Modified:

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?


  • 2
1 Solution
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now