The number in this cell is formatted as text or preceded by an apostrophe

J

Jeremy

I'm creating an excel 10 worksheet in vb .net. If I format a range with

oSheet.Range("G1", "Y1").NumberFormat = "0.00"

the finished worksheet shows the little green triangle in each cell in the
range, and it gives me the message "The number in this cell is formatted as
text or preceded by an apostrophe".

How do I turn these cells back into numbers with the proper numeric format?

Jeremy
 
P

Paul Clement

¤ I'm creating an excel 10 worksheet in vb .net. If I format a range with
¤
¤ oSheet.Range("G1", "Y1").NumberFormat = "0.00"
¤
¤ the finished worksheet shows the little green triangle in each cell in the
¤ range, and it gives me the message "The number in this cell is formatted as
¤ text or preceded by an apostrophe".
¤
¤ How do I turn these cells back into numbers with the proper numeric format?
¤
¤ Jeremy
¤

You may want to post to microsoft.public.excel.programming if you don't get an answer here.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
G

Gary Carr

Try this :

oSheet.Range("G1:Y1").Cells.NumberFormat = "#,##0.00"

instead of this :

oSheet.Range("G1", "Y1").Cells.NumberFormat = "0.00"

Hope this helps

:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top