ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Converting text to value (https://www.excelbanter.com/excel-programming/282580-converting-text-value.html)

nicoll

Converting text to value
 
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






Bernie Deitrick[_2_]

Converting text to value
 
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

"nicoll" wrote in message
...
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









All times are GMT +1. The time now is 10:35 AM.

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