![]() |
GroupName for OptionButton
I have a sheet that has many OptionButtons, I have another shhet in the same
workbook that has the same optionbuttons. Since I just copied the option buttons from 1 page to another, each sheets group names are the same. So I need to go through each OptionButton on the sheet and change the GroupName to the sheet name And groupName. ie: sheet1 has 3 option buttons grouped together named 1.1 I need to change all 3 option buttons GroupName to Sheet11.1 I have hundreds of groups like this so I need the VB to do the work. Thank you!!! This is what I have so far but doesn't work... Sub FixButtons() Dim shp As OptionButton Dim strButName As String For Each shp In Sheets(Sheet1).OptionButton strButName = shp.GroupName shp.GroupName = "Sheet1" + strButName Next shp End Sub Error is "Object doesn't support this Property or method" |
GroupName for OptionButton
Dim sh as Worksheet
Dim oleObj as OleObject for each sh in Worksheets for each oleObj in sh.OleObjects if typeof oleObj.Object is MSforms.OptionButton then oleObj.Object.GroupName = sh.Name end if Next Next -- Regards, Tom Ogilvy "Shawn G." wrote in message ... I have a sheet that has many OptionButtons, I have another shhet in the same workbook that has the same optionbuttons. Since I just copied the option buttons from 1 page to another, each sheets group names are the same. So I need to go through each OptionButton on the sheet and change the GroupName to the sheet name And groupName. ie: sheet1 has 3 option buttons grouped together named 1.1 I need to change all 3 option buttons GroupName to Sheet11.1 I have hundreds of groups like this so I need the VB to do the work. Thank you!!! This is what I have so far but doesn't work... Sub FixButtons() Dim shp As OptionButton Dim strButName As String For Each shp In Sheets(Sheet1).OptionButton strButName = shp.GroupName shp.GroupName = "Sheet1" + strButName Next shp End Sub Error is "Object doesn't support this Property or method" |
GroupName for OptionButton
Awesome, Worked perfectly THANKS!!!
"Tom Ogilvy" wrote: Dim sh as Worksheet Dim oleObj as OleObject for each sh in Worksheets for each oleObj in sh.OleObjects if typeof oleObj.Object is MSforms.OptionButton then oleObj.Object.GroupName = sh.Name end if Next Next -- Regards, Tom Ogilvy "Shawn G." wrote in message ... I have a sheet that has many OptionButtons, I have another shhet in the same workbook that has the same optionbuttons. Since I just copied the option buttons from 1 page to another, each sheets group names are the same. So I need to go through each OptionButton on the sheet and change the GroupName to the sheet name And groupName. ie: sheet1 has 3 option buttons grouped together named 1.1 I need to change all 3 option buttons GroupName to Sheet11.1 I have hundreds of groups like this so I need the VB to do the work. Thank you!!! This is what I have so far but doesn't work... Sub FixButtons() Dim shp As OptionButton Dim strButName As String For Each shp In Sheets(Sheet1).OptionButton strButName = shp.GroupName shp.GroupName = "Sheet1" + strButName Next shp End Sub Error is "Object doesn't support this Property or method" |
GroupName for OptionButton
Tom,
Where do you put this code? In an autoopen proc? Is there some way to get this to run when a new copy of a worksheet is created? Actually, why is this even necessary? KB article http://support.microsoft.com/kb/211978/en-us says GroupNames are mutually exclusive across worksheets. But I'm not finding this to be the case. ie. Radio buttons with the same GroupName property are acting like one group even when they are located on different worksheets. It's not supposed to work that way, but that's what I'm seeing (Excel 2000) "Tom Ogilvy" wrote: Dim sh as Worksheet Dim oleObj as OleObject for each sh in Worksheets for each oleObj in sh.OleObjects if typeof oleObj.Object is MSforms.OptionButton then oleObj.Object.GroupName = sh.Name end if Next Next -- Regards, Tom Ogilvy |
All times are GMT +1. The time now is 01:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com