OK Reinaldo, eu até consegui fazer funcionar , mas o codigo ficou meio BruteForce, queria saber se teria como melhorar
estou tendo que basicamente nomear os Groupnames a cada tres opçãoes, ( lembrando que esse exemplo é só 2 questoes, a planilha completa tem muito mais, e algumas questoes tem 2 ou mais opções.
A numeração dos grupos encontra-se em imagem anexo
Sub IniciarAvaliacao()
Application.ScreenUpdating = False
Sheets("QualidadeIntestinal").Select
Dim x As Integer
Dim MyLeft As Double
Dim MyTop As Double
Dim MyHeight As Double
Dim MyWidth As Double
Dim pctCompl As Single
Dim i As Integer
i = 0
For x = 1 To ThisWorkbook.Sheets("Menu").Range("H13").Value
'Adicionando as Aves
ThisWorkbook.Sheets("QualidadeIntestinal").Cells(4, 4 + x).Value = "Ave " & x
i = i + x
'Adicionando Checkbox linha 5 - Perg.1
MyLeft = Cells(5, 4 + x).Left
MyTop = Cells(5, 4 + x).Top
ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=MyLeft, Top:=MyTop, Width:=12, Height:=12).Select
ActiveSheet.Shapes(Selection.Name).OLEFormat.Object.Object.GroupName = "teste" & i
'Adicionando Checkbox linha 6
MyLeft = Cells(6, 4 + x).Left
MyTop = Cells(6, 4 + x).Top
ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=MyLeft, Top:=MyTop, Width:=12, Height:=12).Select
ActiveSheet.Shapes(Selection.Name).OLEFormat.Object.Object.GroupName = "teste" & i
'Adicionando Checkbox linha 7
MyLeft = Cells(7, 4 + x).Left
MyTop = Cells(7, 4 + x).Top
ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=MyLeft, Top:=MyTop, Width:=12, Height:=12).Select
ActiveSheet.Shapes(Selection.Name).OLEFormat.Object.Object.GroupName = "teste" & i
i = i + 1
'Adicionando Checkbox linha 10 - Perg.2
MyLeft = Cells(10, 4 + x).Left
MyTop = Cells(10, 4 + x).Top
ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=MyLeft, Top:=MyTop, Width:=12, Height:=12).Select
ActiveSheet.Shapes(Selection.Name).OLEFormat.Object.Object.GroupName = "teste" & i
'Adicionando Checkbox linha 11
MyLeft = Cells(11, 4 + x).Left
MyTop = Cells(11, 4 + x).Top
ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=MyLeft, Top:=MyTop, Width:=12, Height:=12).Select
ActiveSheet.Shapes(Selection.Name).OLEFormat.Object.Object.GroupName = "teste" & i
'Adicionando Checkbox linha 12
MyLeft = Cells(12, 4 + x).Left
MyTop = Cells(12, 4 + x).Top
ActiveSheet.OLEObjects.Add(ClassType:="Forms.OptionButton.1", Link:=False, _
DisplayAsIcon:=False, Left:=MyLeft, Top:=MyTop, Width:=12, Height:=12).Select
ActiveSheet.Shapes(Selection.Name).OLEFormat.Object.Object.GroupName = "teste" & i
Next x
Application.ScreenUpdating = True
End Sub
Postado : 02/02/2016 12:01 pm