[comp.windows.ms] Advanced Question on MS Excel

hn277pk@unidui.uni-duisburg.de (Koch) (03/12/91)

Dear Excel experts:

maybe one of you can help me with the following problem:
I would like to put the string "0123" or even better " 0123 " into 
a field. Now using =FORMULA("0123") does not work since
Excel interprets this as =FORMULA(123). Since I must have a string
in the field =FORMULA("=""0123""") is not what I want, even if the result
looks right. I know it is possible to have such a string in a field
but so far I could figure out only the following way: Use a dialog
box with a text field and enter 0123 -- obviously this cannot be used
within macros.

Any clues ?!

Thanks in advance

Peter Koch
University of Duisburg
Germany

jlr1801@aim1.tamu.edu (Jeff Rife) (03/12/91)

In article <1991Mar11.181022.3790@unidui.uni-duisburg.de> hn277pk@unidui.uni-duisburg.de (Koch) writes:
>
>I would like to put the string "0123" or even better " 0123 " into 
>a field. Now using =FORMULA("0123") does not work since
>Excel interprets this as =FORMULA(123). Since I must have a string
>in the field =FORMULA("=""0123""") is not what I want, even if the result
>looks right. I know it is possible to have such a string in a field
>but so far I could figure out only the following way: Use a dialog
>box with a text field and enter 0123 -- obviously this cannot be used
>within macros.
>

Two possibilities, both assuming you just want it in a cell.  I'm not sure
exactly what you do want, but here goes:

1) In the formula bar, type: ="0123"
   You can simulate this in a macro with SEND.KEYS("=""0123"""), if the quotes
   work out.

2) Format the cell using 0000 as the format string.  You'll have to type this
   in yourself.  It will force the number to be displayed with the leading
   zero.

If neither one of these is anything close to what you want to do, please ignore
this post.

--
Jeff Rife   P.O. Box 3836   |   "Because he was human; because he had goodness;
College Station, TX 77844   |    because he was moral they called him insane.
(409) 823-2710              |    Delusions of grandeur; visons of splendor;
jlr1801@aim1.tamu.edu       |    A manic-depressive, he walks in the rain."

vahamri@eos.ncsu.edu (VINCENT A HAMRICK) (03/15/91)

I'm not sure on the windows version (I haven't tried), but on the
Macintosh version you could put what's called a 'soft space' before the
string and it will print just to string.  For windows, the soft space
could be something like Alt-Space bar or Ctrl-Space bar.  Try it.

-Vince
vahamri@eos.ncsu
'They only say never because no one ever has...' -The Dred Pirate Roberts.

cave@randvax.UUCP (Jonathan Cave) (03/20/91)

I presume you are doing this in a macro.  The function TEXT(stuff,format)
will do the trick, e.g. TEXT("0123","0"), or maybe TEXT(0123,"0").  Or
you could type it in a cell as a string (as suggested by other replies) and
fetch it with DEREF().