Suppress the 0 in a form

dantb

Active Member
Joined
Mar 20, 2002
Messages
358
Hi all, I was wondering if there was anyway of not haveing the ( 0 ) on a decimal number. If you type .125 in on a form the next time I view the form it has 0.125, anyway of removing the 0 ? thx Dan
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi dantb

You haven't said what "the form" is, a Worksheet cell, Textbox, ComboBox etc

Anyway you can simply use format like

#.0000
 
Upvote 0
Hi Dave, sorry about that, It is a vba Userform and I save the data that is entered for future viewing. Would #.0000 be all I nead in this vba code ?
 
Upvote 0
This is the code I have in the Text box on the form. Would you enter that in the Code ?

Private Sub TextBox1_AfterUpdate()
Sheets("BUY - SELL").Range("C8").Value = TextBox1.Text
End Sub
 
Upvote 0
Hi dantb

If you are saving this to a Worksheet for later viewing then some code like:

Range("A1").NumberFormat = "#.0000"

Should work

If you are going to need this same format in a TextBox you can use something like:

Dim strNum as string
strNum =format(range("A1"),"#.0000"
 
Upvote 0
Ok Dave thanks again for you help. Just couldnt see how to do it. Thanks again have a good evening. Dan
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top