Converting text to value

N

nicoll

I want to use a macro to check each value in a column and change the
contents from '12 to the number 12 etc , but if the cell has a label like
12A it remains as a label. The following formula does what I want
=IF(ISNUMBER(VALUE(A1))=TRUE,VALUE(A1),A1) but I'd like to do the same with
a macro.

Thanks
 
B

Bernie Deitrick

Nicoll,

Select the cells first, then run this macro:

Sub TransformToFormula()
Dim myCell As Range
For Each myCell In Selection
myCell.Formula = myCell.Text
Next myCell
End Sub

HTH,
Bernie
MS Excel MVP
 

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

Top