View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Userform Textbox Currency Format Problems

Change fires every time you enter a character, so when you start getting the
results of the format, things don't work right

Private Sub TextBoxgencost_Change()
Dim sStr as String
sStr = trim(TextBoxgencost.Text)
sStr = Application.Substitute(Application. _
Substitute(sStr,",",""),"$","")
if Isnumeric(sStr) then
TextBoxgencost.Text = Format( _
TextBoxgencost.Text, "$###,###,##")
End if
End Sub

--
Regards,
Tom Ogilvy


Dunce in SC wrote in message
...
I am having trouble getting a textbox to format user input in currency
When I use the following code

Private Sub TextBoxgencost_Change()
TextBoxgencost.Text = Format(TextBoxgencost.Text, "Currency")
End Sub

Or
Private Sub TextBoxgencost_Change()
TextBoxgencost.Text = Format(TextBoxgencost.Text, "$###,###,##")
End Sub

It will only allow me to enter 4 numbers and then behaves as a counter
and increases the last digit by one .

Thanks for the help



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/