Concatented Numbers Display as Scientific Notation
Dave;
That's basically what I wound up doing.
I guess my question was more in the realm of "What's this?".
I'd never seen this before-mind you, there's a lot of things I haven't seen!.
(Just when I thought I knew what I was doing:-o)
--
Regards;
Rob
------------------------------------------------------------------------
"Dave Peterson" wrote in message
...
You could give that cell a nice number format and not have to worry about what
excel likes to do:
with SrcSht.Cells(i, 1)
.value = SrcSht.Cells(i, 2).value & SrcSht.Cells(i, 3).value
.numberformat= "0"
.entirecolumn.autofit 'stop #'s from showing up.
end with
RWN wrote:
Nick;
Thanks.
I thought that what was the case given that the format is General but, as I mentioned,
only some results will come out correctly if I enlarge the column width.
I tried enlarging the column width both in the UI and the macro (Autofilt).
Looking at it again it seems that if the second field is longer than four digits it
won't
display properly.
i.e. if the concatenated length is 11 digits it screws up.
As noted, the actual value is ok, just the display is "wonky".
I think I'm missing something fundamental here (or a few brain cells).
--
Regards;
Rob
------------------------------------------------------------------------
"Nick Hebb" wrote in message
oups.com...
If the cell is formatted as General (the default) then it will
automatically display as scientific notation if the column is too
narrow. It will revert to normal notation if the column is autosized.
If the column is formatted to Number and the column is too narrow, the
Excel will fill the cell with ####. Again, the number will look normal
when the column width is widened enough.
So if you want the display to look correct, have your macro do a
Columns("A:A").EntireColumn.AutoFit statement after concatenating all
the values.
--
Dave Peterson
|