How to make excel to treat values in cell as a number?
How to make excel to treat values in cell as a number?
set cell = Range("B9")
cell.NumberFormat = "General"
cell.Value = cell.Value
' or for extra assurance
cell.Value = cdbl(cell.Value)
--
Regards,
Tom Ogilvy
"Peri" <noemail@serwer.org> wrote in message news:op.szt6nxbky8ffpb@mcs...
> How to make excel to treat values in cell as a number?
Changing the format of a cell from text to number, or from
number to text will not affect the actual formatting until
the cell value is reentered. F2 then Enter would cause
reentry. A macro such as TrimALL would cause reentry
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
Be careful with cells containing dates.
Changing the format of a number that actually is a number
is effective immediately, as is changing the format of
a text string that is already treated as text is also immediate.
Since this is the programming group you can take care of
everything at once.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
"Tom Ogilvy" <twogilvy@msn.com> wrote in message news:%23f0v7qx4FHA.268@TK2MSFTNGP10.phx.gbl...
> set cell = Range("B9")
> cell.NumberFormat = "General"
> cell.Value = cell.Value
>
> ' or for extra assurance
>
> cell.Value = cdbl(cell.Value)
>
> --
> Regards,
> Tom Ogilvy
>
>
> "Peri" <noemail@serwer.org> wrote in message news:op.szt6nxbky8ffpb@mcs...
> > How to make excel to treat values in cell as a number?
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks