![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Location: Washington State
Posts: 33
|
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 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
Quote:
TextBox3.Value = Range("d4").Text HTH, Russell |
|
|
|
|
|
|
#3 | |
|
Board Regular
Join Date: Feb 2002
Location: Chippenham, UK
Posts: 136
|
Quote:
__________________
Regards, Gary Hewitt-Long |
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Chippenham, UK
Posts: 136
|
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
__________________
Regards, Gary Hewitt-Long |
|
|
|
|
|
#5 |
|
New Member
Join Date: Feb 2002
Location: Washington State
Posts: 33
|
Works perfect Gary, thanks!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|