View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
witek witek is offline
external usenet poster
 
Posts: 69
Default Force a cell to display as Text

Julie wrote:
I am programmatically (via C#) placing data on an Excel spreadsheet. Problem
is that some of the data look like dates (e.g "4/22") which really are not
dates. Excel is automatically converting these to dates. When using Excel, I
can set the cell's format category to "Text" and it will display properly.
How do I do that programatically?


add "'" at the beginning of your text.

var = "'" + var

and now Excel will see it as text.