ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to make excel to treat values in cell as a number? (https://www.excelbanter.com/excel-programming/344857-how-make-excel-treat-values-cell-number.html)

Peri[_3_]

How to make excel to treat values in cell as a number?
 
How to make excel to treat values in cell as a number?

Tom Ogilvy

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" wrote in message news:op.szt6nxbky8ffpb@mcs...
How to make excel to treat values in cell as a number?




David McRitchie

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" wrote in message ...
set cell = Range("B9")
cell.NumberFormat = "General"
cell.Value = cell.Value

' or for extra assurance

cell.Value = cdbl(cell.Value)

--
Regards,
Tom Ogilvy


"Peri" wrote in message news:op.szt6nxbky8ffpb@mcs...
How to make excel to treat values in cell as a number?








All times are GMT +1. The time now is 06:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com