Sub unterbrechen und fortsetzen
14.01.2004 13:35:27
Slimfast
Wie kann ich ein Public
Sub CommantButton_click unterbrechen ohne das mir
Daten aus einem Userform in eine Tabelle geschrieben werden.
Sub soll bei einer NICHT_EINGABE (TEXT o. CombBOX)eine MsgBox öffnen und an der Stelle stehen bleiben wo der Text vergessen wurde ohne dabei die schon ausgefüllten
Textboxen zu leeren oder in eine Tabelle zu schreiben.
Wenn alle Pflichtfelder gefüllt sind sollen die Daten in dem Gleichen CommandButton_1 in die tabelle geschreiben werden und alle Eintäge im Userform gelöscht werden.
Geht das ???
Public
Sub CommandButton1_Click()
If ComboBox1 Like "" Then
Application.Run "VBAProject.Modul1.Pflichtcmbo"
Else: TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
TextBox10 = ""
TextBox11 = ""
TextBox12 = "1"
TextBox13 = ""
TextBox14 = ""
TextBox15 = ""
ComboBox2 = ""
End If
z = Range("B1").End(xlDown).Row + 1
If z > 65000 Then z = 2
Cells(z, 1) = ComboBox1
Cells(z, 2) = TextBox1
Cells(z, 3) = TextBox2
Cells(z, 4) = TextBox3
Cells(z, 5) = TextBox4
Cells(z, 6) = TextBox5
'Cells(z, 7) = CDbl(TextBox6)
Cells(z, 8) = TextBox7
'Cells(z, 9) = CDbl(TextBox8)
Cells(z, 10) = TextBox9
Cells(z, 11) = TextBox10
Cells(z, 12) = TextBox11
Cells(z, 13) = TextBox12
Cells(z, 14) = TextBox13
'Cells(z, 15) = CDate(TextBox14.Text)
Cells(z, 16) = ChekBox1
Cells(z, 17) = ComboBox2
Cells(z, 18) = OptionsButton1
Cells(z, 19) = OptionsButton2
Cells(z, 20) = TextBox16
'TextBox1 = ""
'TextBox2 = ""
'TextBox3 = ""
'TextBox4 = ""
'TextBox5 = ""
'TextBox6 = ""
'TextBox7 = ""
'TextBox8 = ""
'TextBox10 = ""
'TextBox11 = ""
'TextBox12 = "1"
'TextBox13 = ""
'TextBox14 = ""
'TextBox15 = ""
'ComboBox2 = ""
End Sub