Consulting

Results 1 to 3 of 3

Thread: Solved: userform textbox format for currency

  1. #1
    VBAX Contributor
    Joined
    Jul 2009
    Posts
    157
    Location

    Solved: userform textbox format for currency

    This is driving me nuts!

    I had this working and tried to make a change somewhere and now it will not work and I do not remember the original working code. Did I mention I am not too smart ??


    Anyway, my userform has a textbox called Amount. I want to show the text in the textbox of the userform as Currency in the format of $#,###.00 and also want the format entered into the cell in the same format.



    [VBA]
    Private Sub Amount_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    If Amount = vbNullString Then Exit Sub
    If IsNumeric(Me.Amount.Value) Then
    Me.Amount.Value = format(Me.Amount.Value, "$#,###.00")
    Else
    MsgBox "Number value entered"
    End If
    End Sub

    [/VBA]


    The error I receive is " Compile Error - Wrong number of arguments or invalid property assignment "

    I figure it is something obvious I have overlooked but cannot find it.

    Any of you see anything ?


    thanks!

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    try the attached, it should get you headed in the right direction..
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Contributor
    Joined
    Jul 2009
    Posts
    157
    Location
    thanks one more time lucas, that helped. I had been continuing with the problem and it seemed that some of the problem originally was the code I used to enter the number into the spreadsheet cell did not have the same formatting code. Once I got them to match up it seemed to work. You sample file seems to work better than what I figured out. :-)

    I appreciate it!

Posting Permissions

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