On my UserForm, I want to display decimal values in a text box. How do I do that?
Thanks
On my UserForm, I want to display decimal values in a text box. How do I do that?
Thanks
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.Me.TextBox1.Value = Format(iVal, "#0.##")
If you need mroe help than that, please post your code or zip/upload a sample file.
Regards, Zack Barresse
Check out the KB! :|: BOARD TAGS: WHAT ARE THEY AND HOW DO I USE THEM
What is a Microsoft MVP? | Free Microsoft Courses | My Book on Excel Tables
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:Originally Posted by SailFL
Dim Val as Single ' other statements Val = Me.Textbox1.Value ' calculations on Val Me.Textbox2.Value = Format(Val,"#0.###")
"It's not just the due date that's important, it's also the do date" [MWE]
When your problem has been resolved, mark the thread SOLVED by clicking on the Thread Tools dropdown menu at the top of the thread.