ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Limit Characters Shown in a text box (https://www.excelbanter.com/excel-programming/416749-limit-characters-shown-text-box.html)

[email protected]

Limit Characters Shown in a text box
 
Ok...any brainiacs out there!?

I have a userform in excel...
Each Text Box shows a value that is calculated elsewhere within the
spreadsheet...
with the following VB: Me.TxtNamOEM.Text = Range("D15").Value

The value is a calculated value (again taken from the spreadsheet -
the userform acts as a convenient viewer only!).

But the number shows 58.6666666667 (for example) and I want it to only
show 58.67...I have tried changing the Max length property of the text
box (TxtNamOEM) but this doesn't work.

Can anyone help? Thanks in advance

Jamie

Rob Allchurch

Limit Characters Shown in a text box
 
On 9 Sep, 11:38, wrote:
Ok...any brainiacs out there!?

I have a userform in excel...
Each Text Box shows a value that is calculated elsewhere within the
spreadsheet...
*with the following VB: Me.TxtNamOEM.Text = Range("D15").Value

The value is a calculated value (again taken from the spreadsheet -
the userform acts as a convenient viewer only!).

But the number shows 58.6666666667 (for example) and I want it to only
show 58.67...I have tried changing the Max length property of the text
box (TxtNamOEM) but this doesn't work.

Can anyone help? Thanks in advance

Jamie


Try changing "Me.TxtNamOEM.Text = Range("D15").Value " to
"Me.TxtNamOEM.Text = Format(Range("D15").Value, "0.00")"

Cheers


All times are GMT +1. The time now is 03:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com