PDA

View Full Version : Solved: userform textbox format for currency



bdsii
10-30-2009, 10:02 AM
This is driving me nuts! :banghead:

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 ?? :dunno


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.




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




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 ? :think:


thanks!

lucas
10-30-2009, 11:10 AM
try the attached, it should get you headed in the right direction..

bdsii
10-30-2009, 11:32 AM
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!