Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default UserForm TextBox Decimal Places

Hi All,

I've got a UserForm with TextBoxes that when opened fill the TextBoxes with
numerical values form specific worksheet cells.
If the Range value has a number like 4.67, this shows up in the textbox no
problem, but when the range value is 4.00 it appears as 4.
I would like the textboxes show a minimum of two decimal places. Any
assistance would be greatly appreciated.

Private Sub UserForm_Initialize()
TextBox1.Value = Range("C7").Value
TextBox2.Value = Range("C8").Value
TextBox3.Value = Range("C9").Value
TextBox4.Value = Range("C10").Value
End Sub

Best regards,
Pete


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default UserForm TextBox Decimal Places

Pete,

You can use the Format method e.g.

Private Sub UserForm_Initialize()
TextBox1.Value = Format(Range("C7").Value, "0.00")
TextBox2.Value = Format(Range("C8").Value, "0.00")
TextBox3.Value = Format(Range("C9").Value, "0.00")
TextBox4.Value = Format(Range("C10").Value, "0.00")
End Sub

Regards,
Dan
-----------------------------------------
Website : http://www.danielklann.com
Favourites Add-in for Microsoft Excel -
http://www.danielklann.com/excel/exc...tes_add-in.htm


"pcsis" wrote in message
news:VpsJb.139284$ss5.40484@clgrps13...
Hi All,

I've got a UserForm with TextBoxes that when opened fill the TextBoxes

with
numerical values form specific worksheet cells.
If the Range value has a number like 4.67, this shows up in the textbox no
problem, but when the range value is 4.00 it appears as 4.
I would like the textboxes show a minimum of two decimal places. Any
assistance would be greatly appreciated.

Private Sub UserForm_Initialize()
TextBox1.Value = Range("C7").Value
TextBox2.Value = Range("C8").Value
TextBox3.Value = Range("C9").Value
TextBox4.Value = Range("C10").Value
End Sub

Best regards,
Pete




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default UserForm TextBox Decimal Places

Just to add, if you want them to appear as the cells do:

Private Sub UserForm_Initialize()
TextBox1.Value = Range("C7").Text
TextBox2.Value = Range("C8").Text
TextBox3.Value = Range("C9").Text
TextBox4.Value = Range("C10").Text
End Sub

--
Regards,
Tom Ogilvy

pcsis wrote in message
news:VpsJb.139284$ss5.40484@clgrps13...
Hi All,

I've got a UserForm with TextBoxes that when opened fill the TextBoxes

with
numerical values form specific worksheet cells.
If the Range value has a number like 4.67, this shows up in the textbox no
problem, but when the range value is 4.00 it appears as 4.
I would like the textboxes show a minimum of two decimal places. Any
assistance would be greatly appreciated.

Private Sub UserForm_Initialize()
TextBox1.Value = Range("C7").Value
TextBox2.Value = Range("C8").Value
TextBox3.Value = Range("C9").Value
TextBox4.Value = Range("C10").Value
End Sub

Best regards,
Pete




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Decimal Places college student ATL Excel Worksheet Functions 4 September 13th 07 02:12 AM
Subtracting two 2-decimal place numbers gives result 13-decimal places? [email protected] Excel Worksheet Functions 5 March 12th 07 10:38 PM
FIXED 2 DECIMAL PLACES, MUST ENTER ALL ZEROES AFTER DECIMAL POINT. SUKYKITTY Excel Discussion (Misc queries) 3 July 6th 05 01:50 PM
add 2 decimal places Bill M. Excel Discussion (Misc queries) 2 January 28th 05 10:21 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 09:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"