Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Textbox input interpretation

Hello,
in Sweden it's common to use the comma as a decimal delimiter and the period
as thousand delimiter. I have the Regional and Language Options set
accordingly. Textboxes though treats a number written as 1.234,56 as text as
default formatting is ##,##0.00.
It creates formatting problems reading numbers from cells into textboxes and
vice versa.
Can it be solved?
Regards
Mats
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default Textbox input interpretation

Thank you Steven!
It helped!

"Stephen Bullen" wrote:

Hi Mats,

Hello,
in Sweden it's common to use the comma as a decimal delimiter and the period
as thousand delimiter. I have the Regional and Language Options set
accordingly. Textboxes though treats a number written as 1.234,56 as text as
default formatting is ##,##0.00.
It creates formatting problems reading numbers from cells into textboxes and
vice versa.
Can it be solved?


That will happen if you're trying to write the text from the text box directly
to a cell. Instead, wrap it in the CDbl() function, to explicity convert it to
a number, according to your regional settings:

Range("A1").Value = CDbl(txtBox.Text)

For much more information about this, read the "International Issues" chapter
of the Excel 2002 VBA Programmer's Reference, which is available for download
from my web site (http://www.oaltd.co.uk/ExcelProgRef/Default.htm).

Regards

Stephen Bullen
Microsoft MVP - Excel

Professional Excel Development
The most advanced Excel VBA book available
www.oaltd.co.uk/ProExcelDev



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Textbox input interpretation

Hi Mats,

Hello,
in Sweden it's common to use the comma as a decimal delimiter and the period
as thousand delimiter. I have the Regional and Language Options set
accordingly. Textboxes though treats a number written as 1.234,56 as text as
default formatting is ##,##0.00.
It creates formatting problems reading numbers from cells into textboxes and
vice versa.
Can it be solved?


That will happen if you're trying to write the text from the text box directly
to a cell. Instead, wrap it in the CDbl() function, to explicity convert it to
a number, according to your regional settings:

Range("A1").Value = CDbl(txtBox.Text)

For much more information about this, read the "International Issues" chapter
of the Excel 2002 VBA Programmer's Reference, which is available for download
from my web site (http://www.oaltd.co.uk/ExcelProgRef/Default.htm).

Regards

Stephen Bullen
Microsoft MVP - Excel

Professional Excel Development
The most advanced Excel VBA book available
www.oaltd.co.uk/ProExcelDev


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel input mask for textbox DaveF[_2_] Excel Discussion (Misc queries) 3 February 20th 08 03:25 PM
validating input in textbox Jean-Pierre D via OfficeKB.com Excel Programming 1 August 15th 05 08:37 PM
Input mask for userform textbox Axehandler Excel Programming 1 November 6th 04 03:56 AM
validation of input in textbox Peer Excel Programming 3 July 23rd 04 03:06 PM
Limit input in a textbox James Agostinho Excel Programming 2 September 10th 03 03:10 PM


All times are GMT +1. The time now is 10:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"