#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 117
Default user form

I am using a userform on an excel sheet that has a text box which reads
values off a designated cell in the sheet. On my userform the cell value is
rounded to about 8 decimal places and I would only like it to round to 1 or
2. Any idea how I would do that? On the excel sheet I have it rounded to 2
and that doesn't seem to work.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,069
Default user form

One way... Load the cell value into a variable, use the Round function in VBA
to round it to as many decimals as you want, and assign the value of the
(rounded) variable to the textbox's value.

Private Sub UserForm_Initialize()
Dim CellVal As Double
CellVal# = Round(Sheets("Sheet1").Range("B30").Value, 2)
Me.TextBox1.Value = CellVal#
End Sub

Hope this helps,

Hutch

"Jase" wrote:

I am using a userform on an excel sheet that has a text box which reads
values off a designated cell in the sheet. On my userform the cell value is
rounded to about 8 decimal places and I would only like it to round to 1 or
2. Any idea how I would do that? On the excel sheet I have it rounded to 2
and that doesn't seem to work.

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
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
User Form Obi-Wan Kenobi Excel Discussion (Misc queries) 1 March 23rd 06 07:21 PM
User form Mike Rogers Excel Discussion (Misc queries) 2 March 10th 06 05:56 PM
Help On User Form mastee Excel Discussion (Misc queries) 4 August 23rd 05 12:31 PM
User Form Still Trying mully New Users to Excel 3 May 26th 05 06:30 PM


All times are GMT +1. The time now is 04:30 PM.

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"