Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Anzeige
Inhaltsverzeichnis

textbox(en)

Forumthread: textbox(en)

textbox(en)
Sonja
Hallo
gibt es eine möglichkeit alle textboxen abzufragen ob sie leer sind oder muss ich jede
einzelne textbox in eine if abrage prüfen?
gruß sonja
Anzeige

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: textbox(en)
16.01.2011 23:43:44
Josef

Hallo Sonja,
Beispielhaft geht das z. B. so.
Private Sub CommandButton1_Click()
  Dim objCntrl As Msforms.Control
  
  For Each objCntrl In Me.Controls
    If TypeOf objCntrl Is Msforms.TextBox Then
      If objCntrl.Value = "" Then
        MsgBox "Textbox '" & objCntrl.Name & "' ist leer!"
        Exit Sub
      End If
    End If
  Next
End Sub


Gruß Sepp

Anzeige
AW: textbox(en)
17.01.2011 00:26:23
Sonja
Hallo Sepp
danke, ich habe nur nicht bis zum ende gedacht.
ich bräuchte noch eine funktion, wenn eine textbox von allen einen wert hat, dann zb. MsgBox...
statt = einfach -> ungleich ...
17.01.2011 00:48:53
Matthias
Hallo
evtl. ist Sepp nicht mehr Online
probiers einfach mal so:
Private Sub CommandButton1_Click()
Dim objCntrl As Msforms.Control
For Each objCntrl In Me.Controls
If TypeOf objCntrl Is Msforms.TextBox Then
If objCntrl.Value  "" Then
MsgBox "Textbox '" & objCntrl.Name & "' ist nicht leer!"
Exit Sub
End If
End If
Next
End Sub
Gruß Matthias
Anzeige
Anzeige
Anzeige
Live-Forum - Die aktuellen Beiträge
Datum
Titel
14.05.2026 13:31:09
14.05.2026 09:50:42
13.05.2026 19:14:18