Force a cell to display as Text
myRange.numberformat = "@"
Sometimes you can get the answer by recording a macro within excel.
Julie wrote:
Thanks for your help... but I need a way without altering the data values
(via some kind of number formatting). For example, I tried
myRange.NumberFormat = ""; or
myRange.NumberFormat = "Text";
which didn't work. But I'm looking for a solution more along those lines.
Thanks a bunch!
"witek" wrote:
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.
--
Dave Peterson
|