Mar 11, 2011
I am throwing some data out into Excel and am having some formatting troubles. I have 5 columns (date, time, a long number I don't want displayed in scientific notation - text is fine, text, text). I can get it all working with numberformat, however I have to do them different ways.
View 1 Replies
Date works this way cell.numberformat = "m/d/yy" and it formats it to say 3/1/11
Time works this way cell.numberformat = "h:mm AM/PM" and it formats it to say 8:07 AM
For the long number cell.numberformat = "@" and it doesn't change the format and it gets displayed in scientific notation
BUT if I use cell.style.numberformat = "@" it works as it should, but it messes up all of the date and time cells. Apparently when you use style.numberformat, it doesn't just apply to the cell you're working with. If I try using style.numberformat with the date and time formats, they don't change and are entered as if I didn't change the format at all.