Makro abbrechen wenn....
31.03.2014 21:21:19
Spenski
wie muss ich das schreiben das wenn
Private Sub CommandButton1_Click()
Select Case -1 * OptionButton1.Value & -1 * OptionButton2.Value & -1 * OptionButton9.Value
Case "000"
MsgBox "Bitte Schicht wählen"
End Select
zutrifft (also die meldung kommt) der rest des makros nicht ausgeführt wird?
kfg
christian
Private Sub CommandButton1_Click()
Select Case -1 * OptionButton1.Value & -1 * OptionButton2.Value & -1 * OptionButton9.Value
Case "000"
MsgBox "Bitte Schicht wählen"
End Select
Workbooks.Open "C:\Users\Spenski\Desktop\Test.xlsx"
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(1, 0) = TextBox1.Text
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 1) = TextBox11.Text
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 2) = TextBox10.Text
ActiveWorkbook.Close True
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(1, 0) = Now()
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 1) = Now()
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 3) = TextBox1.Text
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 4) = TextBox2.Text
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 5) = TextBox6.Text
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 6) = TextBox3.Text
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 7) = TextBox7.Text
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 8) = TextBox4.Text
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 9) = TextBox5.Text
ListBox6.Clear
Dim c As Integer
For c = 5 To 50
ListBox6.AddItem tabelle1.Cells(c, 14).Value
Next c
If OptionButton1.Value = True Then
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 2) = "A"
End If
If OptionButton2.Value = True Then
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 2) = "B"
End If
If OptionButton3.Value = True Then
Sheets("tabelle1").Cells(65536, 1).End(xlUp).Offset(0, 2) = "C"
End If
Dim objControl As Control
For Each objControl In Controls
Select Case TypeName(objControl)
Case "TextBox"
objControl.Text = ""
Case "ComboBox"
objControl.ListIndex = -1
Case "CheckBox"
objControl.Value = False
End Select
Next
ListBox3.List = Sheets("Tabelle1").Range("M2:N2").Value2
ListBox2.List = Sheets("Tabelle1").Range("o2:p2").Value2
End Sub
Anzeige