Userform:输入值时替换字符

时间:2014-05-29 08:00:25

标签: validation excel-vba replace combobox userform


我希望在ComboBox内输入Userform时更改字符,例如:

我输入一个点,我想让它自动更改为逗号。

另一个例子:我输入一次逗号,我不想再次输入。

所有关于输入数据的验证(我想要数值)。我已经限制了要键入的字符(0-9,点,逗号),到目前为止我做了类似这样的事情来完成我的问题,但我想知道是否还有其他方法?

Private Sub netto_Change()

If netto.Value Like "*." = True Then: netto.Text = Replace(netto.Text, ".", ",")

If Len(netto.Text) - Len(Replace(netto.Text, ",", "")) > 1 Then
    netto.Text = Left(netto.Text, Len(netto.Text) - 1)
End If

Call sprawdz_procent

End Sub

0 个答案:

没有答案
相关问题