Consulting

Results 1 to 3 of 3

Thread: Solved: Format numbers

  1. #1
    VBAX Contributor
    Joined
    Mar 2009
    Location
    Porto, Portugal
    Posts
    180
    Location

    Solved: Format numbers

    Hi
    I need a little help for a little issue:

    In a textbox or combobox
    if I write 1, it would appear 0,01
    if I write 12, it would appear 0,12
    if I write 12345, it would appear 123,45
    if I write 1234500, it woulf appear 12.345,00
    etc.

    Is that simple?

    Thanks
    Last edited by ioncila; 12-30-2009 at 05:46 AM. Reason: SOLVED

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Perhaps something like
    [VBA]Private Sub TextBox1_AfterUpdate()
    With TextBox1
    If IsNumeric(.Text) And InStr(.Text, ".") = 0 Then
    .Text = Format(Val(.Text) / 100, "#,##0.00")
    End If
    End With
    End Sub[/VBA]

  3. #3
    VBAX Contributor
    Joined
    Mar 2009
    Location
    Porto, Portugal
    Posts
    180
    Location
    Thank You Very Much
    Its solved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •