AW: Mehrere OptionButton In Userform
18.03.2011 10:59:04
ransi
HAllo
Gottseidank hast du die OptionButtons nicht umbenannt.
So kannst du einen Zähler drüberlaufen lassen.
Versuch mal so:
' **********************************************************************
' Modul: auf_trag Typ: Userform
' **********************************************************************
Option Explicit
Private Sub CommandButton1_Click()
Dim zelle As Long
Dim I As Integer, Z As Integer, Antwort As String
With Worksheets("Auftrag")
zelle = .Cells(Rows.Count, 4).End(xlUp).Row + 1
.Cells(zelle, 3) = TextBox1
.Cells(zelle, 4) = TextBox2
Z = 1
For I = 5 To 14
Antwort = "Nein" 'Standardantwort
If Me.Controls("OptionButton" & Z) = True Then Antwort = "Ja"
.Cells(zelle, I) = Antwort
Z = Z + 2
Next
End With
End Sub
ransi