+ Reply to Thread
Results 1 to 3 of 3

Microsoft Office VBA - Scientific Notation Question - Am I Blind???

  1. #1
    Registered User
    Join Date
    04-17-2012
    Location
    Texas, USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Question Microsoft Office VBA - Scientific Notation Question - Am I Blind???

    Attachment 174047
    I'm writing a function NumberToWords which converts a number to text and ran into an issue. I'm trying to figure out programatically what is the threshold or trigger that makes VBA automatically convert a number into scientific notation format. I have included more code than Ii wanted to but can't see how to shorten it and get you enough information to see what i am doing. The below samples show why I'm asking the question and need to handle scientific notation conversions. I am trying to avoid passing numbers as "text". Am I missing an obvious fix?

    ?NumberToWords("324356842398732872.205") <-- string delimited processes as expected
    Three Two Four Three Five Six Eight Four Two Three Nine Eight Seven Three Two Eight Seven Two Point Two Zero Five

    ?NumberToWords(324356842398732872.205) <-- Number passed as variant doesn't.
    Three Point Two Four Three Five Six Eight Four Two Three Nine Eight Seven Three Three Zero Zero One Seven

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by Snoday; 08-13-2012 at 06:55 PM. Reason: Added Attachment

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Microsoft Office VBA - Scientific Notation Question - Am I Blind???

    Not a direct answer but you may find the solutions here http://www.contextures.com/excelfilesRon.html#RF0001 on Debrahs's site offer an alternative couple of solutions, one VBA one non VBA
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Microsoft Office VBA - Scientific Notation Question - Am I Blind???

    Numbers in Excel are limited to 15 significant digits by the floating point format your computer uses. For more than that, you must pass them as text.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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