ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to tell textbox to treat number as number, not text, and notshow zero (https://www.excelbanter.com/excel-programming/377455-how-tell-textbox-treat-number-number-not-text-notshow-zero.html)

John Smith

How to tell textbox to treat number as number, not text, and notshow zero
 
If I leave textbox.value blank, textbox treat the number I entered
as text. If I set textbox.value to zero, textbox treats number as
number but it displays a big fat 0.

How do I get textbox to treat number as number and not display
zero but blank instead? Thanks.

NickHK

How to tell textbox to treat number as number, not text, and not show zero
 
John,
A textbox only deal with text :

With TextBox1
MsgBox TypeName(.Value) & " : " & TypeName(.Text)
End With

You have to coerce (CLng, CDbl, etc) the value when you use it

If not want a zero, don't put a zero in the textbox.

NickHK

"John Smith" wrote in message
...
If I leave textbox.value blank, textbox treat the number I entered
as text. If I set textbox.value to zero, textbox treats number as
number but it displays a big fat 0.

How do I get textbox to treat number as number and not display
zero but blank instead? Thanks.





All times are GMT +1. The time now is 10:00 PM.

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