View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Unwanted number format conversion

When I tried it, 04 stayed 04 and the cell was still formatted as text.

You sure you didn't do something else?

Allen_N wrote:

Hi JE, FSt1...

Okay, please Try this.

Format a cell as text, and enter "03". Then, copy and paste this cell to the
one on the right. Then, in the new cell, change "03" to "04". When I do it,
the format of the cell changes from Number to text and the contents become
"4".

By "arrogant" I mean that it seems as though the Excel programmers want to
coerce our data into the format they think it should be, rather than what we
have explicitly typed it to be. I could be wrong; it may just be a bug.

Thanks for the advice. Please let me know if things look different to you now.

"JE McGimpsey" wrote:

XL's input parser is very consistent in how it treats inputs - it treats
values that look like numbers as numbers unless the cell is preformatted
as Text, or the input is prefixed by an apostrophe (').

Not sure what you see as arrogant...


In article ,
Allen_N wrote:

I recently wasted debugging time on a perfectly good macro. The problem
turned out to be Excel: when I manually changed a cell from a value that
looked like a number to another value that looked like a number, Excel
automatically converted the cell's NumberFormat from Text to Number. This
caused a routine that compares cell contents between different worksheets to
fail, because "0399" < 399.

I'm sure most programmers would agree that an application that reassigns
data types without warning the user is arrogant and inconsiderate in the
extreme.

Can I turn this feature off?



--

Dave Peterson