View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Text to Fraction

Hi alan,

Really need to see a sample of the fractions. If it looks like this 1/2 then
it is easy. See example below. Otherwise not so easy.

celValue = ActiveCell

dividePos = InStr(1, celValue, "/") 'Position of division sign

dividend = Val(Left(celValue, dividePos - 1))

divisor = Val(Mid(celValue, dividePos + 1))

result = dividend / divisor

Regards,

Ossiemac


"AlanW" wrote:

I copied some fraction from internet which may be in text format, but there
is no single quote in front of them. How can I change them to fractions or
numbers by using VBA code. Could somebody please help.

Thanks