+ Reply to Thread
Results 1 to 2 of 2

Thread: Currency Displayed in TextBox

  1. #1
    Registered User
    Join Date
    02-14-2006
    Posts
    5

    Currency Displayed in TextBox

    I have various TextBox's on a worksheet and they display as Currency.
    The code for them works well, BUT, will not display $20.10. It would appear to me that the zero following the two(2) is the problem. Any other number displays as it should.
    I have been fiddling with the code for about 2 weeks now with no joy. I reach out for HELP!
    The code (from the web) is as follows.
    Private Sub TextBox6_Change()
        Static Num As Currency
        Static Change As Boolean
        On Error Resume Next
        If Len(TextBox6.Value) = 0 Then Num = Null: Exit Sub
        Change = Not Change
        If Change = False Then Exit Sub
        If Len(TextBox6.Value) <= 1 Then
        Num = TextBox6.Value / 100
        Else
        Num = CCur(Num & Right(TextBox6.Value, 1)) * 10
        End If
        Debug.Print TextBox6.Value, Num
        TextBox6.Value = Format(Num, "$#,##0.00")
    End Sub
    There may be a better way. (I hope)
    Last edited by keenasmustard; 07-23-2011 at 05:09 AM.

  2. #2
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,640

    Re: Currency Displayed in TextBox

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ 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.2.0