On my UserForm, I want to display decimal values in a text box. How do I do that?
Thanks
Printable View
On my UserForm, I want to display decimal values in a text box. How do I do that?
Thanks
Code:TextBox1 = Format(Range("a1"), "#0.#####")
I am not using data from a spreadsheet. I am getting the data from the UserForm from input from the user. Once I have the data, I make some calculations and display it on the form but I want to format and display decimal figures.
Thanks
You can still use the Format method as shown above ...
.. where iVal is your value/variable.Code:Me.TextBox1.Value = Format(iVal, "#0.##")
If you need mroe help than that, please post your code or zip/upload a sample file.
Assuming your initially get input (stuffed in the variable Val) from TextBox1, do some operations on Val and then display the result in TextBox2, the code might look something like this:Quote:
Originally Posted by SailFL
Code:Dim Val as Single
' other statements
Val = Me.Textbox1.Value
' calculations on Val
Me.Textbox2.Value = Format(Val,"#0.###")