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 |
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 |
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 |
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 | | |
All times are GMT +1. The time now is 05:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com