+ Reply to Thread
Results 1 to 5 of 5

function in userform returning 9.9999999999

  1. #1
    Registered User
    Join Date
    10-18-2015
    Location
    Byron California USA
    MS-Off Ver
    2010
    Posts
    2

    Cool function in userform returning 9.9999999999

    Hello,

    Okay, I removed the protection from the vba code in the excel file except the worksheets that have the passwords right in the vba code. Let me know if you have any problems.

    I need someone to take a look at my messy code and tell me what I am doing wrong. The main userform is the hydraulics User Form. It was supposed to just put data into a spreadsheet but then the project kept growing and including a lot of difficult equations. Now the whole thing is just a mess and my boss is going to fire me if I don't get this thing figured out soon.

    Hopefully it isn't too bad and you will be able to see what I am trying to do.

    Here is some of the problem code.

    Please Login or Register  to view this content.
    and here is the function that is also on the userform backside. I couldn't get it to work in the general module place.

    Please Login or Register  to view this content.
    If I input 15.1 and 15.0, this returns 9.999999999 or -9.99999999

    -Scott-
    Attached Files Attached Files
    Last edited by ScottE2HotE; 02-16-2016 at 08:45 PM. Reason: broken rule #1

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,953

    Re: Advanced userform meets Newby

    title updated
    Last edited by protonLeah; 02-16-2016 at 11:26 PM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    10-18-2015
    Location
    Byron California USA
    MS-Off Ver
    2010
    Posts
    2

    Re: Advanced userform meets Newby

    Thank you Ben Van Johnson. I zipped the file and it worked great! I also changed my title. Let me know if this is acceptable.

    Best regards,

    -Scott-

  4. #4
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,347

    Re: function in userform returning 9.9999999999

    Since you are comparing "doubles" you should probably round the numbers to avoid the issue.
    You could round to something like 12 decimal places here it seems.

  5. #5
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    867

    Re: function in userform returning 9.9999999999

    Try this way:
    Please Login or Register  to view this content.
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

+ 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. Advanced UserForm control
    By dageci in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-29-2016, 04:15 PM
  2. Advanced Userform with different user choices
    By Martin Lorentzen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2016, 11:28 AM
  3. Newby
    By rumbo in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 05-18-2014, 07:52 PM
  4. UserForm (Advanced): Copying controls between tabs in a multipage
    By Jon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2012, 11:11 AM
  5. Advanced Textbox in UserForm - Keep Color of Font Same as Cell
    By abousetta in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-11-2011, 07:05 PM
  6. Running an Advanced Filter using Userform check boxes
    By gr6au in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2011, 04:51 PM
  7. Advanced UserForm
    By Blitskrieg in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-09-2010, 04:40 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