Wenn ich das eingegebene aus der Textbox über meine Userform aktiviere, sollen alle eingegebenen Daten (wenn sie bestimmte Kriterien erfüllen)
in die jeweiligen Spalten eingefügt werden.
Das funktioniert soweit super das einzige Problem ist, dass nach jedem Auslösen die Daten in der selben Zeile bleiben.
Ich möchte dass anschließend in einem Bereich von z.B. Zeile 15-34 und Spalte A-P, die Daten nacheinander pro Klick eingefügt werden.
Die nächste Kategorie z.B. Zeile 36-55 und Spalte A-P usw.
So sieht mein Code aus:
Private Sub activateButton_Click()
'Das eingegebene aus der Textbox, wird wenn die jeweiligen Kriterien erfüllt sind, in die richtigen Spalten eingefügt.
'(Kategorie General & Admin)
If ComboBox1.Text = "General & Admin - Office Expenses" Then
r = 15
If ComboBox2.Text = "Januar" Then Cells(r, 5) = TextBox5.Value
If ComboBox2.Text = "Februar" Then Cells(r, 6) = TextBox5.Value
If ComboBox2.Text = "März" Then Cells(r, 7) = TextBox5.Value
If ComboBox2.Text = "April" Then Cells(r, 8) = TextBox5.Value
If ComboBox2.Text = "Mai" Then Cells(r, 9) = TextBox5.Value
If ComboBox2.Text = "Juni" Then Cells(r, 10) = TextBox5.Value
If ComboBox2.Text = "Juli" Then Cells(r, 11) = TextBox5.Value
If ComboBox2.Text = "August" Then Cells(r, 12) = TextBox5.Value
If ComboBox2.Text = "September" Then Cells(r, 13) = TextBox5.Value
If ComboBox2.Text = "Oktober" Then Cells(r, 14) = TextBox5.Value
If ComboBox2.Text = "November" Then Cells(r, 15) = TextBox5.Value
If ComboBox2.Text = "Dezember" Then Cells(r, 16) = TextBox5.Value
End If
If ComboBox1.Text = "General & Admin - Office Expenses" Then
r = 15
Cells(r, 1) = TextBox1
Cells(r, 2) = TextBox4
Cells(r, 3) = TextBox3
Cells(r, 4) = TextBox6
End If
Habe bisher erfolglos im Internet nach der Lösung gesucht.
Ich hoffe Ihr könnt mir Helfen.
|