FORMULA TO REMOVE TEXT FROM A CELL
This macro, a slight modification of Per Jessen's macro to preserve the
period, will do that. HTH Otto
Sub ExtractNumber()
Dim MyVal As String
Dim n As Long
Dim cell As Range
For Each cell In Selection.Cells
MyVal = ""
For n = 1 To Len(cell)
If IsNumeric(Mid(cell, n, 1)) Or _
Mid(cell, n, 1) = "." Then
MyVal = MyVal & Mid(cell, n, 1)
End If
Next
cell.Value = MyVal
MyVal = 0
Next
End Sub
"Per Jessen" wrote in message
...
Then, select the cells to be converted and run this macro:
Sub ExtractNumber()
Dim MyVal As Long
Dim n As Long
For Each cell In Selection.Cells
For n = 1 To Len(cell)
If IsNumeric(Mid(cell, n, 1)) Then
MyVal = MyVal & Mid(cell, n, 1)
End If
Next
cell.Value = MyVal
MyVal = 0
Next
End Sub
Regards,
Per
"Faraz A. Qureshi" skrev i
meddelelsen ...
I am sorry what I sought was to have all the text be removed. Like:
1234Text
12Text34
Text1234
be converted to:
1234
1234
1234
--
Best Regards,
Faraz
"Per Jessen" wrote:
Hi
Use this formula in a helper column, assuming 12 is a true value:
=IF(ISERROR(VALUE(A1)),VALUE(LEFT(A1,FIND("K"A1)-2))A1)
Regards,
Per
"Faraz A. Qureshi" skrev i
meddelelsen ...
I have some entries like:
10 Kg
15 Kilo
12
13.5 Kilogram
How, to have all the text be removed from the same having the
numericals
remained presented as:
10
15
12
13.5
--
Best Regards,
Faraz
|