View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default How to convert this text number and fraction to 1 figure using mac

One way:

Dim rCell As Range
Dim n As Long
For Each rCell In Selection.Cells
With rCell
n = InStr(.Text, " ")
If n 0 Then
On Error Resume Next
.Value = CDbl(Left(.Text, n - 1) & _
Mid(Evaluate(Mid(.Text, n + 1)), 3))
On Error GoTo 0
End If
End With
Next rCell


In article ,
swiftcode wrote:

Hi all,

I have this text in a number of cells typed in as e.g. ".09 1/4" which in
numeric terms is 0.0925.

My questions is, can someone please help me think of a simple macro to
automatically covert the cell to a numeric.

Many thanks in advance.
Ray