ich brauche hilfe.
Ich möchte vier Textboxen nach Inhalt abfragen und wenn in einer Textbox kein Eintrag (x) vorhanden ist eine MsgBox ausgeben.
Wer kann mir helfen.
Danke
Ino
Private Sub CheckTextBox(ByRef sInfo$, ParamArray TxTBox() As Variant)
Dim i As Integer
For i = Lbound(TxTBox) To Ubound(TxTBox)
If TxTBox(i) = "" Then
sInfo = sInfo & TxTBox(i).Name & vbCr
End If
Next i
If sInfo <> "" Then sInfo = "Eintrag fehlt in" & vbCr & vbCr & Left$(sInfo, Len(sInfo) - 1)
End Sub
Private Sub CommandButton1_Click()
Dim sInfo$
CheckTextBox sInfo, TextBox1, TextBox2, TextBox3, TextBox4
If sInfo <> "" Then
MsgBox sInfo, vbExclamation
Else
MsgBox "Alle ausgefüllt", vbInformation
End If
End Sub
Gruß TinoPrivate Function CheckTextBox(ParamArray TxTBox() As Variant) As Boolean
Dim i As Integer
For i = Lbound(TxTBox) To Ubound(TxTBox)
If TxTBox(i) <> "" Then CheckTextBox = True: Exit Function
Next i
End Function
Private Sub CommandButton1_Click()
If CheckTextBox(TextBox1, TextBox2, TextBox3, TextBox4) Then
MsgBox "Mindestens eine Textbox ist gefüllt", vbInformation
Else
MsgBox "keine Textbox gefüllt", vbExclamation
End If
End Sub
Gruß Tino