+ Reply to Thread
Results 1 to 2 of 2

TextBox Format/Editing Problem

  1. #1
    Registered User
    Join Date
    10-27-2004
    Posts
    11

    Question TextBox Format/Editing Problem

    I have a Userform that has several textboxes on it. The textboxes are linked to cells on a worksheet via the controlsource property. I also have formatted the textbox as a number with the following code:

    Private Sub Textbox1_Change()

    TextBox1.value = Format(TextBox1.value, "#,##0.00")

    end sub

    This works fine when the when the form activates, the textboxes have the cell values and the proper format. The problem is when the user tries to change a value in a textbox it will only let them input an amount between 0 and 9.99. I've tried different formats such as "#,###.##" and "0,000.00" with similar results.

    Any help would be greatly appreciated.

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    This code will be invoked when ever cursor from textbox1 is moved to another control.


    Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    TextBox1.Text = Format(TextBox1.Text, "#,##,000.00")
    End Sub

+ 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