14.01.2018, 18:17
Ja das passt besser. Kannst Du mir noch verraten wieso die Schleifen nicht richtig funkzt ?
Code:
Private Sub CommandButton2_Click()
'Erste Freie Zelle auswendig machen
Dim last As Integer
Dim loLetzte As Long
Dim loCo As Long
last = ThisWorkbook.Sheets("Ausleitung").Cells(Rows.Count, 1).End(xlUp).Row + 1
loLetzte = Cells(Rows.Count, 1).End(xlUp).Row + 1
'Einzelene Textfelder in die Zellen eintragen
Worksheets("Ausleitung").Cells(last, 1).Value = TextBox1
Worksheets("Ausleitung").Cells(last, 2).Value = TextBox2
Worksheets("Ausleitung").Cells(last, 3).Value = TextBox3
Worksheets("Ausleitung").Cells(last, 4).Value = TextBox4
Worksheets("Ausleitung").Cells(last, 27).Value = TextBox5
Worksheets("Ausleitung").Cells(last, 28).Value = CDate(TextBox6)
Worksheets("Ausleitung").Cells(last, 33).Value = TextBox6
Worksheets("Ausleitung").Cells(last, 35).Value = TextBox8
Worksheets("Ausleitung").Cells(last, 29).Value = "D005"
Worksheets("Ausleitung").Cells(last, 36).Value = "AJ02"
For loCo = loLetzte To 2 Step -1
Worksheets("Ausleitung").Cells(loCo, 34) = Application.WorksheetFunction.EDate(Cells(loCo, 28), Cells(loCo, 35) * 12)
Worksheets("Ausleitung").Cells(loCo, 32) = Cells(loCo, 28) - 1
Next
For Spalte = 5 To 26
Worksheets("Ausleitung").Cells(last, Spalte).Value = "Nein"
Next Spalte
Unload Me
start.Show
End Sub