-
Solved: Returning a value into a textbox without Decimal Places Shown
1: I am returning VALUE into a textbox within a Userform.
The range in which the VALUE is acquired has been formatted to display as a WHOLE NUMBER without decimal places.
The VALUE returned into the textbox is displayed as the actual number which contains numerous decimal points.
I wish for the VALUE returned to be displayed as a WHOLE number without decimal places.
How may this be accomplished?
2: What may be added to the "Userform.show" command to call for the VALUES to be displayed within the textbox when the Userform is opened?
Thank you for your assistance.
-
Does this help?
[VBA]UserForm1.TextBox1.Value = Format(Range("A1").Value, "0")
UserForm1.Show[/VBA]
-
Thank you Frank !
I'd have responded quicker but the Server has been too busy to get into.
But... Removing the unnecessary decimal places has been accomplished.
Succeeding in filling the Textbox information when the Userform.show command is executed has not.
I'm still working on that portion of the task.
Thanks again !
-
Where does the value come from? A cell?
Perhaps something like.
[vba]Private Sub UserForm_Initialize()
Me.TextBox1.Value = Format(Sheet1.Range("A1").Value, "0")
End Sub[/vba]
-
Frank,
I found a solution to activate the userform and insert the values within the textbox's. I created a sub-routine - "userform_activate" which includes a messagebox (which is needed). Upon execution / acknowledgement of the messagebox, the values are shown within the textbox as desired.
[VBA]Private Sub UserForm_activate()
MsgBox "Replace the Proposed Component Quantities with the Actual Quantities Used."
Me.1.Value = Format(Range("b11").Value, 0)
Me.2.Value = Round(Range("B12").Value, 0)
Me.3.Value = Round(Range("B13").Value, 0)
Me.4.Value = Round(Range("B14").Value, 0)
Me.5.Value = Round(Range("B15").Value, 0)
Me.6.Value = Round(Range("B16").Value, 0)
Me.7.Value = Round(Range("F18").Value, 0)
End Sub[/VBA]
Thank you for responding.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules