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.
Bookmarks