ich benutze diesen Code:
Private Sub CommandButton1_Click()
Dim last As Integer, i As Integer
Dim strOUT As String
Dim wks2 As Worksheet
Application.ScreenUpdating = False
Set wks2 = Worksheets("Schaden")
Worksheets("Schaden").Activate
wks2.Unprotect "2510"
last = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row + 1
ActiveSheet.Cells(last, 1).Value = UserForm1.Headset.Value
ActiveSheet.Cells(last, 2).Value = UserForm1.Seriennummer.Value
ActiveSheet.Cells(last, 3).Value = UserForm1.Perso.Value
ActiveSheet.Cells(last, 4).Value = UserForm1.Datum.Value
ActiveSheet.Cells(last, 5).Value = UserForm1.Schaden.Value
ActiveSheet.Cells(last, 7).Value = UserForm1.zuWAMAS.Value
ActiveSheet.Cells(last, 15).Value = UserForm1.User.Value
With UserForm1.Maßnahmen
For i = 0 To .ListCount - 1
If .Selected(i) Then
strOUT = strOUT & ", " & .List(i)
End If
Next i
End With
ActiveSheet.Cells(last, 6).Value = Mid(strOUT, 3)
wks2.Protect "2510"
Worksheets("Zettel").Activate
ActiveSheet.Range("b6").Value = Mid(strOUT, 3)
ActiveSheet.Range("b3").Value = UserForm1.Headset.Value
ActiveSheet.Range("b4").Value = UserForm1.Seriennummer.Value
ActiveSheet.Range("b9").Value = UserForm1.zuWAMAS.Value
ActiveSheet.Range("b5").Value = UserForm1.Schaden.Value
ActiveSheet.Range("b8").Value = UserForm1.User.Value
Sheets("Zettel").Visible = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
Sheets("Zettel").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Grundliste").Select
Range("B7").Select
Application.ScreenUpdating = True
End Sub
Private Sub UserForm_Initialize()
Dim lZeile As Long, i As Long
'Worksheets("Dropdown").Activate
Schaden.RowSource = "Dropdown!E2:E8"
'Style der auswahl
Schaden.ListStyle = fmListStyleOption
Maßnahmen.RowSource = "Dropdown!F2:F7"
Headsetzurueck.RowSource = "Dropdown!B2:B3"
'TextBox3.RowSource = "Grundliste!n2:n5000"
TextBox4.RowSource = "Dropdown!c2:c9"
TextBox5.RowSource = "Dropdown!h2:h33"
TextBox6.RowSource = "Dropdown!i2:i20"
TextBox7.RowSource = "Dropdown!j2:j36"
TextBox8.RowSource = "Dropdown!d2:d3"
TextBox9.RowSource = "Dropdown!B2:B3"
TextBox10.RowSource = "Reserve!A2:A500" 'hh
TextBox16.RowSource = "Dropdown!d2:d3"
TextBox17.RowSource = "Dropdown!a1:a3"
'Worksheets("Grundliste").Activate
Seriennummer.RowSource = "Grundliste!A2:K" & Worksheets("Grundliste").Cells(Rows.Count, "J"). _
End(xlUp).Row
Perso.RowSource = "Grundliste!A2:K" & Worksheets("Grundliste").Cells(Rows.Count, "A").End(xlUp). _
Row
'UserForm1.Headset.RowSource = "Grundliste!K2:K9999"
User.Value = Application.UserName
Datum.Value = Now
vonWAMAS.Value = Now
ListBox1.BoundColumn = 2
ListBox1.ColumnCount = 2
ListBox1.ColumnWidths = "0;50"
'Eintrag Datum und Text für die ANSICHT von Tabelle3 FERTIGNEU
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
TextBox9 = ""
TextBox10 = ""
TextBox11 = ""
'TextBox12 = ""
TextBox13 = ""
TextBox14 = ""
TextBox15 = ""
TextBox16 = ""
TextBox17 = ""
TextBox18 = User.Value
TextBox19 = User.Value
ListBox1.Clear
Call Listbox1fuellen 'aufruf der Subroutine
ListBox1.ListIndex = IIf(ListBox1.ListCount > 1, 0, -1)
End Sub
Jetzt möchte ich gerne das bei der Listbox Schaden ein MUSS ausgewählt wird. Das heißt, wähle ich keins aus, muss eine Meldung kommen " Eine Auswahl ist Pflicht" dann geht es erst weiter zum speicher.Kann mir jemand helfen das einzubauen ?
Danke