26.04.2019, 12:08
Hallo,
danke der Helfer habe ich nun folgende Lösung
Vielen Dank nochmal
danke der Helfer habe ich nun folgende Lösung
Code:
Private Sub Userform_Initialize()
MsgBox "Es müssen immer kleine Teige eingegeben werden"
TextBox3 = Format$(Date, "dd.mm.yyyy")
End Sub
'Button: Übernehmen
Private Sub CommandButton1_Click()
Dim lz1 As Long 'LastZell in Tabelle1
On Error GoTo Fehler
lz1 = Cells(Rows.Count, 1).End(xlUp).Row + 1
'Parameter
Cells(lz1, 1) = TextBox1.Text
Cells(lz1, 2) = TextBox2.Text
Cells(lz1, 3) = TextBox3.Text
If IsNumeric(TextBoxTT) Then Cells(lz1, 4) = TextBoxTT * 1
If IsNumeric(TextBoxTRW) Then Cells(lz1, 5) = TextBoxTRW * 1
If IsNumeric(TextBoxTRS) Then Cells(lz1, 6) = TextBoxTRS * 1
If IsNumeric(TextBoxRD) Then Cells(lz1, 7) = TextBoxRD * 1
If IsNumeric(TextBoxRE) Then Cells(lz1, 8) = TextBoxRE * 1
If IsNumeric(TextBoxKZLkl) Then Cells(lz1, 9) = TextBoxKZLkl * 1
If IsNumeric(TextBoxKZSkl) Then Cells(lz1, 10) = TextBoxKZSkl * 1
If IsNumeric(TextBoxKZLgr) Then Cells(lz1, 77) = TextBoxKZLgr * 1
If IsNumeric(TextBoxKZSgr) Then Cells(lz1, 78) = TextBoxKZSgr * 1
'Maische
If IsNumeric(TextBoxMAISCHEW) Then Cells(lz1, 11) = TextBoxMAISCHEW * 1
If IsNumeric(TextBoxMAISCHERB) Then Cells(lz1, 12) = TextBoxMAISCHERB * 1
'Quellstück
Cells(lz1, 13) = ComboBoxQS1.Text
If IsNumeric(TextBoxQS1) Then Cells(lz1, 15) = TextBoxQS1 * 1
Cells(lz1, 16) = ComboBoxQS2.Text
If IsNumeric(TextBoxQS2) Then Cells(lz1, 18) = TextBoxQS2 * 1
Cells(lz1, 19) = ComboBoxQS3.Text
If IsNumeric(TextBoxQS3) Then Cells(lz1, 21) = TextBoxQS3 * 1
If IsNumeric(TextBoxTE) Then Cells(lz1, 22) = TextBoxTE * 1
'Bestreuung
Cells(lz1, 23) = ComboBox_Bestreuung1.Text
If IsNumeric(TextBoxBESTREUUNG1) Then Cells(lz1, 25) = TextBoxBESTREUUNG1 * 1
Cells(lz1, 26) = ComboBox_Bestreuung2.Text
If IsNumeric(TextBoxBESTREUUNG2) Then Cells(lz1, 28) = TextBoxBESTREUUNG2 * 1
Cells(lz1, 29) = ComboBox_Bestreuung3.Text
If IsNumeric(TextBoxBESTREUUNG3) Then Cells(lz1, 31) = TextBoxBESTREUUNG3 * 1
Cells(lz1, 32) = ComboBox_Bestreuung4.Text
If IsNumeric(TextBoxBESTREUUNG4) Then Cells(lz1, 34) = TextBoxBESTREUUNG4 * 1
'Rohstoffe
Cells(lz1, 35) = ComboBoxR1.Text
If IsNumeric(TextBoxR1) Then Cells(lz1, 37) = TextBoxR1 * 1
Cells(lz1, 38) = ComboBoxR2.Text
If IsNumeric(TextBoxR2) Then Cells(lz1, 40) = TextBoxR2 * 1
Cells(lz1, 41) = ComboBoxR3.Text
If IsNumeric(TextBoxR3) Then Cells(lz1, 43) = TextBoxR3 * 1
Cells(lz1, 44) = ComboBoxR4.Text
If IsNumeric(TextBoxR4) Then Cells(lz1, 46) = TextBoxR4 * 1
Cells(lz1, 47) = ComboBoxR5.Text
If IsNumeric(TextBoxR5) Then Cells(lz1, 49) = TextBoxR5 * 1
Cells(lz1, 50) = ComboBoxR6.Text
If IsNumeric(TextBoxR6) Then Cells(lz1, 52) = TextBoxR6 * 1
Cells(lz1, 53) = ComboBoxR7.Text
If IsNumeric(TextBoxR7) Then Cells(lz1, 55) = TextBoxR7 * 1
Cells(lz1, 56) = ComboBoxR8.Text
If IsNumeric(TextBoxR8) Then Cells(lz1, 58) = TextBoxR8 * 1
Cells(lz1, 59) = ComboBoxR9.Text
If IsNumeric(TextBoxR9) Then Cells(lz1, 61) = TextBoxR9 * 1
Cells(lz1, 62) = ComboBoxR10.Text
If IsNumeric(TextBoxR10) Then Cells(lz1, 64) = TextBoxR10 * 1
Cells(lz1, 65) = ComboBoxR11.Text
If IsNumeric(TextBoxR11) Then Cells(lz1, 67) = TextBoxR11 * 1
Cells(lz1, 68) = ComboBoxR12.Text
If IsNumeric(TextBoxR12) Then Cells(lz1, 70) = TextBoxR12 * 1
Cells(lz1, 71) = ComboBoxR13.Text
If IsNumeric(TextBoxR13) Then Cells(lz1, 73) = TextBoxR13 * 1
Cells(lz1, 74) = ComboBoxR14.Text
If IsNumeric(TextBoxR14) Then Cells(lz1, 76) = TextBoxR14 * 1
Exit Sub
Fehler: MsgBox "Eingabe Fehler aufgetreten"
End Sub
'Button: Abbrechen
Private Sub CommandButton2_Click()
Unload Me
End Sub