+ Reply to Thread
Results 1 to 6 of 6

Converting Decimal to Fraction Text VBA

  1. #1
    Registered User
    Join Date
    07-27-2014
    Location
    London
    MS-Off Ver
    2007
    Posts
    16

    Question Converting Decimal to Fraction Text VBA

    Hi Guys,

    Is there any easy way to convert a decimal to a text fraction in vba.

    In excel itself you can use e.g. =text(B5,"0/00"), however VBA doesn't support the function.
    E.g. To32nd = To32nd & Text(extravar, "0/000") says undefined function Text.

    Is there any easy way to do this?

    Much Appreciated!

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Converting Decimal to Fraction Text VBA

    Try something like this:
    Please Login or Register  to view this content.
    or this:
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Converting Decimal to Fraction Text VBA

    Hi,

    Try one of the following:
    Please Login or Register  to view this content.
    Lewis

  4. #4
    Registered User
    Join Date
    07-27-2014
    Location
    London
    MS-Off Ver
    2007
    Posts
    16

    Re: Converting Decimal to Fraction Text VBA

    Hi thanks for those responses, they work well when referring to a decimal in a cell in the sheet, however I'm trying to apply it to output from a VBA calc, which I've stored the result of in extravar. Unfortunately they prove less effective in that situation.

    Any thoughts on how to do that?

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Converting Decimal to Fraction Text VBA

    Try the following:
    Please Login or Register  to view this content.
    Lewis

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Converting Decimal to Fraction Text VBA

    So...This example doesn't work for you?

    Please Login or Register  to view this content.
    Last edited by Ron Coderre; 07-27-2014 at 09:39 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 07-01-2014, 03:23 AM
  2. Replacing Fraction to decimal it is not converting
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-17-2014, 03:16 AM
  3. this tool for converting to fraction to decimal it is not running properly
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-07-2014, 10:46 AM
  4. Converting decimal into a fraction via vba
    By pooky in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2013, 08:32 PM
  5. [SOLVED] formula for converting decimal to inch & fraction
    By davepatrob in forum Excel General
    Replies: 1
    Last Post: 12-31-2005, 11:15 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1