View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Ensuring a cell is copied in text format

Hi

One way:
b.Value = "'" & a.Text

HTH. Best wishes Harald

"Richard H" skrev i melding
9...
I have a macro that uses the following code to copy the value from
the named range "a" to the named range "b" in another workbook:

a.Formula = a.Value2
a.Copy b

The problem is that the "b" cell gets formatted as Date, even though
it's preformatted as Text and the "a" cell also is formatted as Text.
(The "a" cell contains text like 11/2004, so the value is interpreted
as a date on arrival.)

I need to ensure that the "b" cell is formatted as Text, and that it
doesn't convert the original text to a "date number" like 38292. How
can this be done??