Thanks:  0
Likes:  0

# Thread: Textbox - Easy One (Hopefully)

1. I have a userform in which one of the text boxes displays information from a particular cell on the worksheet. I have formatted the cell in question to only display integer, ie no decimal places, but when the value is imported into the textbox, the textbox displays 8 decimal places. How do I display only the characters to the left of the decimal point in the textbox? The code is below, but is pretty simple actually.

TextBox3.Value = Range("d4")

Thanks for any help,

Rick

2. On 2002-02-26 12:38, RWinfield wrote:
I have a userform in which one of the text boxes displays information from a particular cell on the worksheet. I have formatted the cell in question to only display integer, ie no decimal places, but when the value is imported into the textbox, the textbox displays 8 decimal places. How do I display only the characters to the left of the decimal point in the textbox? The code is below, but is pretty simple actually.

TextBox3.Value = Range("d4")

Thanks for any help,

Rick
Try this:

TextBox3.Value = Range("d4").Text

HTH,

Russell

3. On 2002-02-26 12:38, RWinfield wrote:
I have a userform in which one of the text boxes displays information from a particular cell on the worksheet. I have formatted the cell in question to only display integer, ie no decimal places, but when the value is imported into the textbox, the textbox displays 8 decimal places. How do I display only the characters to the left of the decimal point in the textbox? The code is below, but is pretty simple actually.

TextBox3.Value = Range("d4")

Thanks for any help,

Rick
TextBox3.Value = Int(Range("D4").value)

4. My last post didn't take into account the fact that if you have set the cell format to not show any numbers after the decimal point, the number in the sheet may be rounded up.

Try this:

MyInteger = Range("D4").Text ' Converts to text
MyInteger = Int(MyInteger) ' converts back to an integer.
TextBox1.Value = MyInteger

5. Works perfect Gary, thanks!

## User Tag List

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•