Code für alle Textboxen eines Books
08.10.2006 20:53:11
Mathias
Wie kann man den Code so gestalten, dass er für alle Textboxen mit der Bezeichnung Datum innerhalb des Worksheets genutzt wird?
Gruß Mathias
Private Sub txtVermoegenPerson6_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean) 'Datum mit Punkten
With txtVermoegenPerson6
.Value = txtVermoegenPerson6.Value
If .Value = "" Then
ElseIf InStr(1, .Value, ".") = 0 Then
If Len(.Value) = 6 Or Len(.Value) = 8 Then
.Value = Left(.Value, 2) & "." & Mid(.Value, 3, 2) & "." & Mid(.Value, 5)
Else
.SetFocus
Cancel = True
.SelStart = 0
.SelLength = Len(.Value)
End If
End If
End With
End Sub