ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formatting combobox (https://www.excelbanter.com/excel-programming/323859-formatting-combobox.html)

JT[_2_]

formatting combobox
 
In a form users, enter an amount in a text box. They can
enter 2.00, 2.0 or 2 for $2.00. This data is then moved
to a combobox.

However the user enters the data is how it appears in the
combobox.

Is there a way to either (1) format the amount as 2.00
automatically, no matter how they enter it, or (2) force
the user to enter the data correctly before they can leave
the text box (private sub?)?

Thanks for the help....Mike

Tom Ogilvy

formatting combobox
 
sStr = Textbox1.Text
sStr = replace(sStr,"$","")
if isnumeric(sStr) then
sStr = format(cdbl(sStr),"0.00")
Combobox1.AddItem sStr
End if
--
Regards,
Tom Ogilvy

"JT" wrote in message
...
In a form users, enter an amount in a text box. They can
enter 2.00, 2.0 or 2 for $2.00. This data is then moved
to a combobox.

However the user enters the data is how it appears in the
combobox.

Is there a way to either (1) format the amount as 2.00
automatically, no matter how they enter it, or (2) force
the user to enter the data correctly before they can leave
the text box (private sub?)?

Thanks for the help....Mike





All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com