View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] bodhi2.71828@gmail.com is offline
external usenet poster
 
Posts: 22
Default doesn't recognize fraction in string as numeric

I hacked my way through this using:

Private Function FractionToNumeric(strToConvert As String) As Double
Dim intNumerator As Integer, intDenominator As Integer,
intSlashLocation As Integer
intSlashLocation = InStr(1, strToConvert, "/", vbTextCompare)
If intSlashLocation 0 Then
intNumerator = Left(strToConvert, intSlashLocation - 1)
intDenominator = Right(strToConvert, Len(strToConvert) -
intSlashLocation)
FractionToNumeric = intNumerator / intDenominator
End If
End Function

But it still seems like there should be an easier way to do this. I
feel like I must be reinventing the wheel here ....