Convert text into number code

Feb 17, 2010
Reaction score
Hi all,

Hope you can help me cus i been everywhere and tried everything already.

i need to convert all the numbers in a sheet from text to number format so it would do the calculations.

On selected columns i used the following code to convert text to number:

Sub ConvertText2Num()
[color=black][font=Verdana]For Each xCell In Selection
xCell.Value = CDec(xCell.Value)
Next xCell[/font][/color]
[color=black][font=Verdana]	 [/font][/color]
[color=black][font=Verdana]End Sub[/font][/color]

It works great except for 2 things... one: i need it to convert the whole column except the first line cus tht one is the header.
And secondly it gives me an error if there are any cells that do have number formatting and does not continue formatting the other cells that do not have the number formatting.

Any advice to help me reach my objective would be greatly appreciated.

Thank you in advance,


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question