+ Reply to Thread
Results 1 to 3 of 3

UDF Doesn't work with top level Do While-Loop

  1. #1
    Registered User
    Join Date
    12-01-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    UDF Doesn't work with top level Do While-Loop

    I am trying to develop a UDF that will calculate the mass of a formula. In order to do that I need to be able to extract the element and it's associated number (e.g. C and 20). If the string C20H22 is in cell A1 and Emass(A1) is entered into A2 the result of 240 is correctly shown in cell A2 (mass of C = 12, 20 * 12 = 240) when the top level Do While Loop is made inactive by making it a comment (as shown below). However if the top level While-Loop is uncommented the function fails. The top level loop is supposed to go through the entire formula and revise the mass as a new element and number is found. Any ideas why the top level Do While Loop is causing the UDF to fail?


    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: UDF Doesn't work with top level Do While-Loop

    indium,

    Please read forum rule 8 about cross post.
    It appears you are receiving answers here.
    http://www.mrexcel.com/forum/showthread.php?t=602378
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  3. #3
    Registered User
    Join Date
    12-01-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: UDF Doesn't work with top level Do While-Loop

    Sorry. I'll read it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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