Ich versuche schon seit einigen Wochen ein Haushaltsbuch als Übung zu machen.
Ich möchte aus einer UserForm mit drei Textfelder und einer Kombobox die Daten in Tabellenblat 2 zu schreiben. Dabei soll das Datum in A2, die Kategorie in B2 usw. geschrieben werden. Beim nächsten Eintrag sollen die Daten darunter gesetzt werden also immer Zeile für Zeile
Das ist das was ich bis jetzt zusammengebracht habe, aber es funktioniert einfach nicht.
Option Explicit
Private Sub cmbEintragen_Click()
Dim LoLetzte As Long
LoLetzte = IIf(IsEmpty(Cells(Rows.Count, 1)), Cells(Rows.Count, 1).End(xlUp).Row, Rows.Count) + _
_
1
Worksheets("Tabelle2").Cells(LoLetzte, 1) = txtDatum.Value
LoLetzte = IIf(IsEmpty(Cells(Rows.Count, 2)), Cells(Rows.Count, 2).End(xlUp).Row, Rows.Count) + _
_
1
Worksheets("Tabelle2").Cells(LoLetzte, 2) = cboKategorie.Value
LoLetzte = IIf(IsEmpty(Cells(Rows.Count, 3)), Cells(Rows.Count, 3).End(xlUp).Row, Rows.Count) + _
_
1
Worksheets("Tabelle2").Cells(LoLetzte, 3) = txtArtikel.Value
LoLetzte = IIf(IsEmpty(Cells(Rows.Count, 4)), Cells(Rows.Count, 4).End(xlUp).Row, Rows.Count) + _
_
1
Worksheets("Tabelle2").Cells(LoLetzte, 4) = txtPreis.Value
'Felder löschen
txtDatum = ""
txtArtikel = ""
txtPreis = ""
End Sub
Bitte, bitte helft mir!
Peter