Gruppe
Dialog
Bereich
TextBox
Thema
Termine in Jahrestabelle eintragen
Problem
Wie kann ich Reitstunden mit Angaben über Uhrzeit, Reiter und Pferd in einen Jahreskalender eintragen lassen?
Lösung
Geben Sie den nachfolgenden Code in das Klassenmodul der UserForm ein.
StandardModule: basMain
Sub CallForm()
frmTermin.Show
End Sub
ClassModule: frmTermin
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim vRow As Variant
Dim iCol As Integer
If IsDate(txtDate) = False Then
Beep
MsgBox "Kein gültiges Datum!"
Exit Sub
End If
vRow = Application.Match(CDbl(CDate(txtDate.Text)), Columns(1), 0)
If IsError(vRow) Then
Beep
MsgBox "Datum wurde nicht gefunden!"
Exit Sub
End If
iCol = WorksheetFunction.CountA(Rows(vRow)) + 1
Cells(vRow, iCol).Value = txtTime.Text
Cells(vRow, iCol + 1).Value = txtReiter.Text
Cells(vRow, iCol + 2).Value = txtGaul.Text
End Sub