laut Hilfe hat wohl jedes Objekt einer UF eine Index-Nummer, so dass ich die mit einer Schleife abarbeiten könnte. Wo aber finde ich die Index-Nummer für jedes Objekt? In den Eigenschaften jedenfalls nicht.
Danke und Gruß
David
For i = 1 To 9
Me.Controls("TextBox" & i).Value = i
Next
Den Index den Du meinst gibt es meines Wissens nur in VB, aber nicht in VBA.Dim myCtl As Control
For Each myCtl In UserForm1.Controls
If TypeOf myCtl Is MSForms.TextBox Then
myCtl.Value = Now
End If
Next
Dim myCol As New Collection
Private Sub CommandButton1_Click()
Dim myCtl As Control
For Each myCtl In myCol
myCtl.Value = Now
Next
End Sub
Private Sub UserForm_Initialize()
With Me
myCol.Add .TextBox1
myCol.Add .TextBox5
myCol.Add .TextBox7
End With
End Sub
Gruss, JogyPrivate Sub CommandButton1_Click()
Dim iIndx As Integer
For iIndx = 1 To 7
If Trim(Controls("TextBox" & iIndx)) = "" Then
MsgBox "Bitte auch die TextBox" & iIndx & " ausfüllen - danke", _
16, " Hinweis für " & Application.UserName
Exit For
End If
Next iIndx
End Sub
Gruß Peter