Gruppe
Dialog
Problem
Über Optionsfelder wird eine InputBox zur Zahlen- oder eine zur Zeichenfolgeneingabe aufgerufen.
ClassModule: frmEingabe
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub optNumber_Click()
Dim vValue As Variant
Dim iRow As Integer
vValue = Application.InputBox( _
prompt:="Zahleneingabe", _
Title:="Zahl", _
Type:=1)
If vValue = False Then Exit Sub
If IsEmpty(Cells(1, 1)) Then
iRow = 1
Else
iRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
End If
Cells(iRow, 1).Value = vValue
End Sub
Private Sub optString_Click()
Dim vValue As Variant
Dim iRow As Integer
vValue = Application.InputBox( _
prompt:="Zeichenfolgeneingabe", _
Title:="Zeichenfolge", _
Type:=2)
If vValue = False Then Exit Sub
If IsEmpty(Cells(1, 1)) Then
iRow = 1
Else
iRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
End If
Cells(iRow, 1).Value = vValue
End Sub
StandardModule: Modul1
Sub CallForm()
frmEingabe.Show
End Sub