ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Showing Group Delimiter in text field (https://www.excelbanter.com/excel-programming/337429-showing-group-delimiter-text-field.html)

Rob F

Showing Group Delimiter in text field
 
Hi

I've got a VBA form which has a number of text boxes for entering integers.

However, when inputting 100000 it doesn't look much different from 1000000.
Once the data is processed it's easy to format the number to show e.g
1,000,000 using FormatNumber.

But is there any way to show the number in the box after updating with the
group delimiters, but still retain the underlying value for manipulation once
a command is run?

I tried using:
Private Sub txtBox_AfterUpdate()
txtBox.Value = FormatNumber(txtBox.Value, 0, , -1)
End Sub

This worked fine in the box, e.g. it showed 10000 as 10,000. But when it
came to processing the txtBox.Value was only 10, i.e. it knocked off
everything after the first delimeter.

Any advice much appreciated.

Rob F

Tom Ogilvy

Showing Group Delimiter in text field
 
Maybe use Cdbl to do the converison

dblVal = cdbl(txtbox.value)

--
Regards,
Tom Ogilvy

"Rob F" wrote in message
...
Hi

I've got a VBA form which has a number of text boxes for entering

integers.

However, when inputting 100000 it doesn't look much different from

1000000.
Once the data is processed it's easy to format the number to show e.g
1,000,000 using FormatNumber.

But is there any way to show the number in the box after updating with the
group delimiters, but still retain the underlying value for manipulation

once
a command is run?

I tried using:
Private Sub txtBox_AfterUpdate()
txtBox.Value = FormatNumber(txtBox.Value, 0, , -1)
End Sub

This worked fine in the box, e.g. it showed 10000 as 10,000. But when it
came to processing the txtBox.Value was only 10, i.e. it knocked off
everything after the first delimeter.

Any advice much appreciated.

Rob F





All times are GMT +1. The time now is 04:08 PM.

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