ich hab hier einen Code, bei dem ich nicht ganz weiß, was ich daan falsch mache.
Hierbei soll jede Textbox mit dem Namen txtVermoegen* so formatirt werden, dass man nur noch Zahlen eingeben kann. Was mache ich falsch?
Sub Zahlenformat_Textboxen()
Dim vis As Control
Static sLastText As String
Static sInProc As Boolean
For Each vis In EbgVermoegen.Controls
If vis.Name Like "txtVermoegen*" Then
With vis
If sInProc Then
Exit Sub
Else
sInProc = True
End If
.Text = Replace(.Text, ".", "")
If CBool(Len(.Text) = 0) Or IsNumeric(.Text) Then
sLastText = .Text
Else
Beep
.Text = sLastText
End If
If Len(.Text) = 0 Then
.Text = "0"
End If
If .Text = "0" Then
.SelStart = 0
.SelLength = 1
End If
End With
sInProc = False
End If
Next vis
End Sub
Gruß
Mathias