Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi.
I use Range to insert some numbers to the sheet. All works find. But I have one problem. Excel converts numbers like 2.76 to 1 febrary 1976. How to avoid this? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It sounds like the cells format is incorrect
Have you tried changing the cell format to number ? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200601/1 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can I do this,and for what have i to change it?
"Crowbar via OfficeKB.com" wrote: It sounds like the cells format is incorrect Have you tried changing the cell format to number ? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200601/1 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Artem,
If your locallized date setting allows the use of . as the date delimiter, then Excel could interpret "2.76" (a string) as a date. Beyond that, post your code. HTH, Bernie MS Excel MVP "Artem Omelianchuk" wrote in message ... Hi. I use Range to insert some numbers to the sheet. All works find. But I have one problem. Excel converts numbers like 2.76 to 1 febrary 1976. How to avoid this? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you for interest.
I understand this,but how can i avoid tis behaviour? I can't post my code today,i make this tomorrow. But in general I Get Range from the Worksheet and add SafeArray there. Number represented by string. "Bernie Deitrick" wrote: Artem, If your locallized date setting allows the use of . as the date delimiter, then Excel could interpret "2.76" (a string) as a date. Beyond that, post your code. HTH, Bernie MS Excel MVP "Artem Omelianchuk" wrote in message ... Hi. I use Range to insert some numbers to the sheet. All works find. But I have one problem. Excel converts numbers like 2.76 to 1 febrary 1976. How to avoid this? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Artem,
Check your "Regional and language options" from the control panel in windows, specifically, the regional options for short date. How to avoid this in the code depends on how you are assigning your cell values. Perhaps along the lines of: With Range("A1") .NumberFormat = "0.00" .Value = CDbl(SafeArray(i)) End With HTH, Bernie MS Excel MVP "Artem Omelianchuk" wrote in message ... Thank you for interest. I understand this,but how can i avoid tis behaviour? I can't post my code today,i make this tomorrow. But in general I Get Range from the Worksheet and add SafeArray there. Number represented by string. "Bernie Deitrick" wrote: Artem, If your locallized date setting allows the use of . as the date delimiter, then Excel could interpret "2.76" (a string) as a date. Beyond that, post your code. HTH, Bernie MS Excel MVP "Artem Omelianchuk" wrote in message ... Hi. I use Range to insert some numbers to the sheet. All works find. But I have one problem. Excel converts numbers like 2.76 to 1 febrary 1976. How to avoid this? |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Here are my code: CString start; start.Format(_T("A%d"),m_rowsCount+2); CRange oRange; oRange = m_sheet.get_Range(COleVariant(start), m_covOptional); oRange = oRange.get_Resize(COleVariant((short)1),COleVarian t((short)m_numberOfFields)); oRange.put_NumberFormat(COleVariant(_T("#,##0.00") ) ); oRange.put_NumberFormatLocal(COleVariant(_T("#,##0 .00")) ); oRange.put_Value(sa); ,where sa is COleSafeArray. But when i try to change number format I get COleDispatchException - "Can't change number format of class Range". What I'm doing wrong. "Bernie Deitrick" wrote: Artem, Check your "Regional and language options" from the control panel in windows, specifically, the regional options for short date. How to avoid this in the code depends on how you are assigning your cell values. Perhaps along the lines of: With Range("A1") .NumberFormat = "0.00" .Value = CDbl(SafeArray(i)) End With HTH, Bernie MS Excel MVP "Artem Omelianchuk" wrote in message ... Thank you for interest. I understand this,but how can i avoid tis behaviour? I can't post my code today,i make this tomorrow. But in general I Get Range from the Worksheet and add SafeArray there. Number represented by string. "Bernie Deitrick" wrote: Artem, If your locallized date setting allows the use of . as the date delimiter, then Excel could interpret "2.76" (a string) as a date. Beyond that, post your code. HTH, Bernie MS Excel MVP "Artem Omelianchuk" wrote in message ... Hi. I use Range to insert some numbers to the sheet. All works find. But I have one problem. Excel converts numbers like 2.76 to 1 febrary 1976. How to avoid this? |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I make some research and find, that this behavior because of
UseSystemSeparators property. So now I turn off this property and all works fine. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 c++ automation problem. | Excel Worksheet Functions | |||
Excel Automation Problem With Add-Ins | Excel Programming | |||
Problem in graph automation in excel. | Excel Programming | |||
TypeConverter Excel-Automation problem | Excel Programming | |||
How to insert Excel Worksheet Name using Automation in VB Dot Net?? | Excel Programming |