+ Reply to Thread
Results 1 to 3 of 3

it is possible to format a Form TextBox Value?

  1. #1
    Registered User
    Join Date
    08-18-2004
    Posts
    97

    it is possible to format a Form TextBox Value?

    Hello

    I 'm working with VBA Forms and i would like to keep the numbers with just 3 decimals, but i can't find a way to do this with the properties of a Form. Is this possible or I have to handle the number before and after showing it in the textbox window?

    Any help appreciated

    Thanks

    Jose Luis

  2. #2
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845
    Hi,

    Not sure if this is what you want, but this code will set the textbox to 3 decimals.
    When you Tab or press the Enter key the textbox will show 3 decimals.




    Private Sub Textbox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) 'tab key
    Application.ScreenUpdating = False
    If KeyCode = "9" Or KeyCode = "13" Then
    If IsNumeric(TextBox1.Value) Then
    TextBox1.Value = Format(TextBox1.Value, " #,##0.000")
    End If
    End If
    End Sub

    Charles

  3. #3
    Registered User
    Join Date
    08-18-2004
    Posts
    97

    Thank you

    Thank you so much Charles , that's what i was looking for.


    Jose Luis

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1