![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 06:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com