January 12, 2010

When text cells don't act like text cells

I've got a table of data in which I want one column to contain only text values of numbers. For example, I want values like 4700, 33, 2.7, 0.01, etc., to be represented not as numbers but as text. This is desired because I use a macro that expects to find text values in that column.

So I formatted the whole column of data as text, but found that the macro still didn't see the values as text.

Turns out that this is because once the numbers had been entered into the cells, that caused the cells to be set to numeric format, and this format was not affected by my subsequent attempt to set the cells' format to text.

To get around this, I cleared the cells, set their format to text, then entered the values.

No comments: