+ Reply to Thread
Results 1 to 2 of 2

Problem with Formatting Textboxes

  1. #1
    Henryhbb
    Guest

    Problem with Formatting Textboxes

    I have several userforms built with about 60 textboxes. I have the textboxes
    bound to cells on a worksheet usung the controlsource property. I have also
    created a class module for all the textboxes so that events can occurr inside
    of one code for all of them. In the class moduel I have the textboxes
    formatted with the Change event with the following code:

    Public WithEvents textgroup As MSForms.TextBox

    Private Sub textgroup_Change()
    textgroup.Value = Format(textgroup.Value, "Standard")
    End Sub

    This works fine when the form first loads, the values from the linked cells
    load into the form and they are formatted properly. However, when the user
    goes to change a value it will only let them enter 3 digits. The format seems
    to only allow entry of numbers after the decimal point. I've tried using
    other events to handle the format such as AfterUpdate and Exit and they
    either do not work or they are unavailable to the new class. Is there any
    way to make this work? The only other way that I can think of is to write a
    separate format code for each textbox, and needless to say that would take a
    while and make the code rather sloppy. I would greatly appreciate any help
    anyone can offer.

    Thanks

    Henry

  2. #2
    Registered User
    Join Date
    08-20-2003
    Location
    Luton, England
    Posts
    63
    Have you tried something like :-
    textgroup.Value = Format(textgroup.Value, "###,###.00")
    Regards
    BrianB
    Most problems are caused by starting from the wrong place.
    Use a cup of coffee to speed up all Windows processes.
    It's easy until you know how.
    -----------------------------------------

+ 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