Private Sub cmdBestelleingabe_Click()
Dim i As Integer
Dim WS1 As Worksheet
Set WS1 = Sheets("Bestellungen & Aktivierungen")
WS1.Activate
Range("A1").Select
'Worksheets("Bestellungen & Aktivierungen").Unprotect Password:="27823142782"
'erste freie Zeile in Blatt 2, Spalte A finden
lgLetzte = WS1.[b65536].End(xlUp).Row + 1
For i = 1 To 12
If BestellForm.Controls("txtBestellbehälter" & i) <> "" Then GoTo Weiter Else NextPosition
Weiter:
If BestellForm.Controls("txtBestellbehälter" & i) <> "" Or _
BestellForm.Controls("txtBestellvorstufe" & i) <> "" Or _
BestellForm.Controls("txtBestellinhalt" & i) <> "" Or _
BestellForm.Controls.txtSapnumBestellFormr <> "" Or _
BestellForm.Controls.txtBestelldatum <> "" Then msg "Bitte alle Felder einer Position ausfüllen" Else
WS1.Cells(lgLetzte, 1) = BestellForm.Controls("txtBestellbehälter" & i).Text
WS1.Cells(lgLetzte, 2) = BestellForm.Controls.txtSapnumBestellFormr.Text
WS1.Cells(lgLetzte, 3) = BestellForm.Controls.Bestelldatum.Text
WS1.Cells(lgLetzte, 4) = BestellForm.Controls("txtBestellVorstufe" & i).Text
WS1.Cells(lgLetzte, 5) = BestellForm.Controls("txtBestellinhalt" & i).Text
End If
NextPosition:
Next
'Sheets("Katalysatorbehälter voll (PHG)").Protect ("27823142782")
End Sub