Problem mit dem Code
05.09.2018 10:29:31
Andre
Ich habe ein Code der mir immer eine Fehlermeldung ausgibt :(
Was habe ich vergessen steh hier grad auf dem Schlauch und komme nicht weiter.
Es wäre nett wenn jemand mal drüber schauen könnte und mit ein Tipp geben könnte
Danke schon mal.
Hier mein Code:
Private Sub CommandButton1_Click()
Dim objtxt As Object
For Each objtxt In UserForm1.Controls
If TypeName(objtxt) = "TextBox" Then
If objtxt.Value = "" Then
MsgBox " Es wurden nicht alle Textfelder ausgefüllt.!", 48
objtxt.SetFocus
Exit Sub
End If
End If
Next
With Sheets("Tabelle2")
.Range("B4") = TextBox1.Value
.Range("D4") = TextBox2.Value
.Range("B13") = TextBox3.Value
.Range("D13") = TextBox4.Value
.Range("I13") = TextBox5.Value
.Range("E21") = TextBox6.Value
.Range("H21") = TextBox7.Value
.Range("K4") = TextBox8.Value
Sheets("Tabelle1").Select
Dim intErsteLeereZeile As Long
intErsteLeereZeile = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row + 1
ActiveSheet.Cells(intErsteLeereZeile, 1).Value = Me.TextBox1.Value
ActiveSheet.Cells(intErsteLeereZeile, 2).Value = Me.TextBox2.Value
ActiveSheet.Cells(intErsteLeereZeile, 3).Value = Me.TextBox3.Value
ActiveSheet.Cells(intErsteLeereZeile, 4).Value = Me.TextBox4.Value
ActiveSheet.Cells(intErsteLeereZeile, 5).Value = Me.TextBox5.Value
ActiveSheet.Cells(intErsteLeereZeile, 6).Value = Me.TextBox6.Value
ActiveSheet.Cells(intErsteLeereZeile, 7).Value = Me.TextBox7.Value
ActiveSheet.Cells(intErsteLeereZeile, 8).Value = Me.TextBox8.Value
End With
Sheets("Tabelle2").Select
Dim Wert As String
x = InputBox("Bitte geben Sie die Anzahl der Exemplare ein:", "Wie viele Exemplare:", "1")
For i = 1 To x
ActiveWindow.SelectedSheets.PrintOut
Wert = Range("I4").Value
Range("I4").Value = Wert + 1
Next i
End Sub