Betrifft: UserForm TextBox mit ComboBox Datum vergleichen
von: Andreas
Betrifft: AW: UserForm TextBox mit ComboBox Datum vergleichen
von: 1712046.html
Option Explicit
Private Sub CommandButton1_Click()
Dim dtmDate1 As Date, dtmDate2 As Date
If ComboBox1.ListIndex = -1 Then
Call MsgBox("Bitte einen Monat auswählen.", vbExclamation, "Hinweis")
Else
If ComboBox2.ListIndex = -1 Then
Call MsgBox("Bitte ein Jahr auswählen.", vbExclamation, "Hinweis")
Else
If ListBox1.ListIndex = -1 Then
Call MsgBox("Bitte einen Datum auswählen.", vbExclamation, "Hinweis")
Else
dtmDate1 = CDate(Label1.Caption)
dtmDate2 = CDate("01." & ComboBox1.Text & "." & ComboBox2.Text)
If Month(dtmDate1) <> Month(dtmDate2) Or Year(dtmDate1) <> Year(dtmDate2) Then
Call MsgBox("Das Monat oder das Jahr weicht ab.", vbExclamation, "Hinweis")
Else
'Mach was anderes
End If
End If
End If
End If
End Sub
Private Sub ListBox1_Click()
Label1.Caption = ListBox1.Text
End Sub
Private Sub UserForm_Initialize()
Dim lngMonth As Long, lngYear As Long
With Tabelle1
ListBox1.List = .Range(.Cells(2, 1), .Cells(.Rows.Count, 1).End(xlUp)).Value
End With
For lngMonth = 1 To 12
Call ComboBox1.AddItem(pvargitem:=MonthName(lngMonth))
Next
For lngYear = 2000 To 2030
Call ComboBox2.AddItem(pvargitem:=CStr(lngYear))
Next
End Sub
Betrifft: Danke klappt super
von: 1712187.html
Geschrieben am: 10.09.2019 09:57:24
Hallo Nepumuk,
super
genau das was ich gesucht habe. Funktioniert bestens
nochmals recht herzlichen Dank für Deine schnelle Hilfe
Gruß Andreas
Betrifft: noch mal auf offen gestellt. Brauche nochmal Hilfe
von: 1712293.html
Private Sub cbo_Beenden_Click()
'Dim Antwort As Byte
Dim Cancel As Byte
Dim dtmDate1 As Date, dtmDate2 As Date
If ComboBox118.ListIndex = -1 Then
Call MsgBox("Bitte einen Monat auswählen.", vbExclamation, "Hinweis")
Else
If ComboBox119.ListIndex = -1 Then
Call MsgBox("Bitte ein Jahr auswählen.", vbExclamation, "Hinweis")
Else
If ListBox1.ListIndex = -1 Then
Call MsgBox("Bitte einen Datum auswählen.", vbExclamation, "Hinweis")
Else
dtmDate1 = CDate(Label633.Caption)
dtmDate2 = CDate("01." & ComboBox118.Text & "." & ComboBox119.Text)
If Month(dtmDate1) <> Month(dtmDate2) Or Year(dtmDate1) <> Year(dtmDate2) Then
If MsgBox("ACHTUNG!!! aktuelle Termineingaben weichen vom Terminplan ab. PRÜFEN _
und gegebenenfalls Terminplan anpassen.", vbYesNo + vbQuestion, "Achtung") = vbYes Then
End
'Cancel = True
'Cancel = False
Else
'Mach was anderes
'Call MsgBox("Andreas Test", vbExclamation, "Hinweis")
End If
End If
End If
End If
End If
If ComboBox118.ListIndex = -1 Then
Call MsgBox("Bitte einen Monat auswählen.", vbExclamation, "Hinweis")
Else
If ComboBox119.ListIndex = -1 Then
Call MsgBox("Bitte ein Jahr auswählen.", vbExclamation, "Hinweis")
Else
If ListBox1.ListIndex = -1 Then
Call MsgBox("Bitte einen Datum auswählen.", vbExclamation, "Hinweis")
Else
dtmDate1 = CDate(Label633.Caption)
dtmDate2 = CDate("01." & ComboBox118.Text & "." & ComboBox119.Text)
If Month(dtmDate1) <> Month(dtmDate2) Or Year(dtmDate1) <> Year(dtmDate2) Then
'Call MsgBox("Achtung!!! Die Eingabe für den Monat oder das Jahr weichen _
vom Datum Baubeginn ab (evl. korriegieren) oder unter Bemerkung Abweichung kurz begründen.", vbExclamation, "Hinweis")
If MsgBox("ACHTUNG!!! aktuelle Termineingaben weichen vom Terminplan ab. PRÜFEN _
und gegebenenfalls Terminplan anpassen.", vbYesNo + vbQuestion, "Achtung") = vbYes Then
End
'Cancel = True
'Cancel = False
Else
'Mach was anderes
'Call MsgBox("Andreas Test", vbExclamation, "Hinweis")
End If
End If
End If
End If
End If
If ComboBox121.ListIndex = -1 Then
Call MsgBox("Bitte einen Monat auswählen.", vbExclamation, "Hinweis")
Else
If ComboBox122.ListIndex = -1 Then
Call MsgBox("Bitte ein Jahr auswählen.", vbExclamation, "Hinweis")
Else
If ListBox1.ListIndex = -1 Then
Call MsgBox("Bitte einen Datum auswählen.", vbExclamation, "Hinweis")
Else
dtmDate1 = CDate(Label637.Caption)
dtmDate2 = CDate("01." & ComboBox121.Text & "." & ComboBox122.Text)
If Month(dtmDate1) <> Month(dtmDate2) Or Year(dtmDate1) <> Year(dtmDate2) Then
If MsgBox("ACHTUNG!!! aktuelle Termineingaben weichen vom Terminplan ab. PRÜFEN _
und gegebenenfalls Terminplan anpassen.", vbYesNo + vbQuestion, "Achtung") = vbYes Then
'End
'Cancel = True
Cancel = False
Else
'Mach was anderes
'Call MsgBox("Andreas Test", vbExclamation, "Hinweis")
End If
End If
End If
End If
End If
If ComboBox121.ListIndex = -1 Then
Call MsgBox("Bitte einen Monat auswählen.", vbExclamation, "Hinweis")
Else
If ComboBox122.ListIndex = -1 Then
Call MsgBox("Bitte ein Jahr auswählen.", vbExclamation, "Hinweis")
Else
If ListBox1.ListIndex = -1 Then
Call MsgBox("Bitte einen Datum auswählen.", vbExclamation, "Hinweis")
Else
dtmDate1 = CDate(Label637.Caption)
dtmDate2 = CDate("01." & ComboBox121.Text & "." & ComboBox122.Text)
If Month(dtmDate1) <> Month(dtmDate2) Or Year(dtmDate1) <> Year(dtmDate2) Then
If MsgBox("ACHTUNG!!! aktuelle Termineingaben weichen vom Terminplan ab. PRÜ _
FEN und gegebenenfalls Terminplan anpassen.", vbYesNo + vbQuestion, "Achtung") = vbYes Then
End
'Cancel = True
'Cancel = False
Else
End If
End If
End If
End If
End If
Unload Me
End Sub
Betrifft: AW: noch mal auf offen gestellt. Brauche nochmal Hilfe
von: 1712295.html
Private Sub CommandButton1_Click()
Dim dtmDate1 As Date, dtmDate2 As Date
If ComboBox1.ListIndex = -1 Then
Call MsgBox("Bitte einen Monat auswählen.", vbExclamation, "Hinweis")
Else
If ComboBox2.ListIndex = -1 Then
Call MsgBox("Bitte ein Jahr auswählen.", vbExclamation, "Hinweis")
Else
If ListBox1.ListIndex = -1 Then
Call MsgBox("Bitte einen Datum auswählen.", vbExclamation, "Hinweis")
Else
dtmDate1 = CDate(Label1.Caption)
dtmDate2 = CDate("01." & ComboBox1.Text & "." & ComboBox2.Text)
If Month(dtmDate1) <> Month(dtmDate2) Or Year(dtmDate1) <> Year(dtmDate2) Then
If MsgBox("Das Monat oder das Jahr weicht ab.", _
vbExclamation Or vbYesNoCancel, "Hinweis") <> vbYes Then Call Unload(Object:=Me)
Else
'Mach was anderes
End If
End If
End If
End If
End Sub
Betrifft: AW: noch mal auf offen gestellt. Brauche nochmal Hilfe
von: 1712297.html
Private Sub CommandButton1_Click()
Dim dtmDate1 As Date, dtmDate2 As Date
If ComboBox1.ListIndex = -1 Then
Call MsgBox("Bitte einen Monat auswählen.", vbExclamation, "Hinweis")
Else
If ComboBox2.ListIndex = -1 Then
Call MsgBox("Bitte ein Jahr auswählen.", vbExclamation, "Hinweis")
Else
If ListBox1.ListIndex = -1 Then
Call MsgBox("Bitte einen Datum auswählen.", vbExclamation, "Hinweis")
Else
dtmDate1 = CDate(Label1.Caption)
dtmDate2 = CDate("01." & ComboBox1.Text & "." & ComboBox2.Text)
If Month(dtmDate1) <> Month(dtmDate2) Or Year(dtmDate1) <> Year(dtmDate2) Then
If MsgBox("Das Monat oder das Jahr weicht ab.", _
vbExclamation Or vbYesNoCancel, "Hinweis") = vbNo Then Call Unload(Object:=Me)
Else
'Mach was anderes
End If
End If
End If
End If
End Sub
Betrifft: Danke funktioniert
von: 1712412.html
Geschrieben am: 11.09.2019 10:18:45
Hallo Nepumuk,
ja so funktioniert es
Danke nochmals für deine schnelle Hilfe
Gruß Andreas