Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I fill a cell in a user form from a selection on same form? | Excel Discussion (Misc queries) | |||
User Form | Excel Discussion (Misc queries) | |||
User form | Excel Discussion (Misc queries) | |||
Help On User Form | Excel Discussion (Misc queries) | |||
User Form Still Trying | New Users to Excel |