#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default Text to Fraction

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,440
Default Text to Fraction

Maybe you don't need VBA:

Format an empty cell as number. EditCopy. Select your fractions. EditPaste special, check Multiply.

Depending on what your fractions look like, they may also be converted to dates, so be careful.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

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


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,440
Default Text to Fraction

<check Multiply

Make that:

check Add

!!

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Niek Otten" wrote in message ...
| Maybe you don't need VBA:
|
| Format an empty cell as number. EditCopy. Select your fractions. EditPaste special, check Multiply.
|
| Depending on what your fractions look like, they may also be converted to dates, so be careful.
|
| --
| Kind regards,
|
| Niek Otten
| Microsoft MVP - Excel
|
| "AlanW" wrote in message ...
||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
|
|


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert fraction format to text format ...... Epinn New Users to Excel 3 November 19th 06 01:19 AM
How do I change fraction to fraction characters? cmcqueary2806 Excel Worksheet Functions 1 November 2nd 06 09:58 PM
fraction b166er Excel Worksheet Functions 5 August 3rd 06 06:30 PM
fraction b166er Excel Discussion (Misc queries) 1 August 3rd 06 06:12 PM
How do I change a text fraction. eg 1 1/2 into a decimal number, . antac Excel Worksheet Functions 1 February 28th 05 05:02 PM


All times are GMT +1. The time now is 01:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"