FORCE decimal entry during edit

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

FORCE decimal entry during edit

Post by sal21 »

Have a txtbox1.
In textbo1, i need during entry, auto format number with decimal number, possible?

similar:
if i insert 1 automaticlly in textbox1 1,00, if i insert 11245 automaticlly in textbox1 1.124,50, ecc...

User avatar
HansV
Administrator
Posts: 78481
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: FORCE decimal entry during edit

Post by HansV »

Like this:

Code: Select all

Private Sub TextBox1_AfterUpdate()
    If IsNumeric(Me.TextBox1) Then
        Me.TextBox1 = Format(Me.TextBox1, "#,##0.00")
    End If
End Sub
Best wishes,
Hans