Gruppe
Dialog
Problem
Wenn in einer UserForm im ersten Gruppenfeld das 2. und im 2. Das 3. Optionsfeld aktiviert sind, soll ein neues Tabellenblatt hinzugefügt werden.
StandardModule: basMain
Sub CallForm()
frmOptions.Show
End Sub
ClassModule: frmOptions
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim iA As Integer, iB As Integer
iA = opt(Frame1, 0)
iB = opt(Frame2, 4)
If iA = 2 And iB = 3 Then
Worksheets.Add.Move after:=Worksheets(Worksheets.Count)
Else
Beep
MsgBox "Nein, ich tue nur was, wenn die " & _
"Optionsfelder 2 und 3 aktiviert sind!"
End If
End Sub
Private Function opt(fme As Frame, iAct As Integer) As Integer
Dim iCounter As Integer
For iCounter = 1 + iAct To 4 + iAct
If fme.Controls("OptionButton" & iCounter).Value = True Then
opt = iCounter - iAct
Exit Function
End If
Next iCounter
End Function