ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Form Text Box (https://www.excelbanter.com/excel-programming/325208-user-form-text-box.html)

Paul

User Form Text Box
 
How can I create a text box that will return a single?

I have user form that has two labels and one text box. Label One shows the
base rate. Text Box allows the user input a markup. Label Two should show the
total rate, consisting of the markup and the base rate.

I programmed a label.caption update at the text box change event, but I get
a data mismatch because the text box returns text even if the input is
numeric.

Also, how can I configure the text box so that all values input show as
percentages, similar to the % format on a normal worksheet cell?

Thanks,

Paul

--
Paul

George[_26_]

User Form Text Box
 
Paul,

Regarding the data mismatch:
Need to use function like CSng to convert the textbox string to a
single data type.
sMarkup = CSng(UserForm.TextBox.Value)

You may also want to validate what the user enters, with IsNumeric
function.

Not sure about the format question.

George


gocush[_29_]

User Form Text Box
 
How can I create a text box that will return a single? <<<<

You may need to contact a dating service for this. ;-)



"Paul" wrote:

How can I create a text box that will return a single?

I have user form that has two labels and one text box. Label One shows the
base rate. Text Box allows the user input a markup. Label Two should show the
total rate, consisting of the markup and the base rate.

I programmed a label.caption update at the text box change event, but I get
a data mismatch because the text box returns text even if the input is
numeric.

Also, how can I configure the text box so that all values input show as
percentages, similar to the % format on a normal worksheet cell?

Thanks,

Paul

--
Paul



All times are GMT +1. The time now is 11:16 AM.

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