Die Fehlermeldung
Laufzeitffehler 1004 - Die Add-Eigenschaft des GroupBoxes-Objektes kann nicht festgelegt werden
bzw. (wenn ich die GroupBox auskommentiere)Laufzeitffehler 1004 - Die Add-Eigenschaft des OptionButton-Objektes kann nicht festgelegt _
werden
Sub MakeOptionButtons_minimal(ByVal FrageNummer As Integer, ByVal ZeileStart As Integer, ByVal _
Choices As Integer)
Dim btn As OptionButton
Dim i As Long
Dim t, s As Range
Dim box As GroupBox
Dim firstbutton As OptionButton
Dim extra As Variant
Set t = ActiveWorkbook.Sheets("Formular").Range(Cells(ZeileStart + 2, 1), Cells(ZeileStart + _
2, 1))
extra = 1.5 * t.RowHeight
Set s = ActiveWorkbook.Sheets("Formular").Range(Cells(ZeileStart + 2 + 1, 1), Cells( _
ZeileStart + 2 + Choices - 1, 1))
Set box = ActiveWorkbook.Sheets("Formular").GroupBoxes.Add(s.Left, s.Top - extra, s.Width, s. _
height + 1.5 * extra)
box.name = "GruppenFeldFrage" & FrageNummer
For i = ZeileStart + 2 To ZeileStart + 2 + Choices - 1 Step 1
Set t = ActiveWorkbook.Sheets("Formular").Range(Cells(i, 1), Cells(i, 1))
Set btn = ActiveWorkbook.Sheets("Formular").OptionButtons.Add(t.Left + 20, t.Top, 0.5 * t. _
Width, t.height)
With btn
.Caption = ""
.name = "ButtonFrage" & FrageNummer & "_" & i - (ZeileStart + 2) + 1
If i = ZeileStart + 2 Then
Set firstbutton = btn
End If
End With
Next i
firstbutton.LinkedCell = "$I$" & ZeileStart + 2
box.Visible = False
End Sub