Converting text to value

  • Thread starter Thread starter nicoll
  • Start date Start date
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
 
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
 
Back
Top