ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to format a label to 2 decimal places (https://www.excelbanter.com/excel-programming/364192-how-format-label-2-decimal-places.html)

GEM

how to format a label to 2 decimal places
 
i have a label in an excel userform and need to format it as the numbers are
showing up as 139.9 when it should be 139.90 how do i do this?
thanks in advance

Jim Thomlinson

how to format a label to 2 decimal places
 
Add a blank form and then drop a text box and a lebel onto the form. add this
code to the form. Run the form and type a number into the text box...

Private Sub TextBox1_Change()
If IsNumeric(TextBox1.Text) Then _
Label1.Caption = Format(TextBox1.Text, "#,##0.00")
End Sub
--
HTH...

Jim Thomlinson


"gem" wrote:

i have a label in an excel userform and need to format it as the numbers are
showing up as 139.9 when it should be 139.90 how do i do this?
thanks in advance



All times are GMT +1. The time now is 01:51 AM.

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