+ Reply to Thread
Results 1 to 11 of 11

Invalid procedure call or argument

  1. #1
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189

    Invalid procedure call or argument

    Hi,

    This error occured me, and i clicked "Debug" to see where was the error and i found a strange thing that i don't know how to solve it:
    The line has the following code:
    Please Login or Register  to view this content.
    If i put the mouse pointer over the variables, i can see it's values, so:
    rei=64574
    pri=-4,08E-04
    ni=0,4
    nui=0 -> this happen and i don't know why. The strange thing is that every variables are defined as "Double", so it should gone wright.

    Can anyone help me?

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Can you post the entire code?
    Last edited by BigBas; 11-07-2007 at 10:27 AM.

  3. #3
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189
    Hi, thankyou BIgbas for the attentio.
    For now i'll post you only the 3 places where"nui"appears, because the code is too much big, but if you desire, i'll post the full one.

    1st place:
    Please Login or Register  to view this content.
    2nd place:
    Please Login or Register  to view this content.
    3rd place:
    Please Login or Register  to view this content.
    ->imidietly after the 2nd place.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Can you post more of the code, and your declarations in particular? I get nui = 7.1455...

  5. #5
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189
    shg,

    I've tried to post everything, but as i said to you, it gave me an error because de text was too long.
    So, here i'll post whats necessary, because there's some code that really doesn't matter.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Hmm. Does Option Explicit appear at the top of the module where the problem occurs?

  7. #7
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189
    No, if i select "Debug" at the moment of the error appears, i goes to that line of rui. I looked up and nothing. I've tried also to use "Option Explicit" and it gave me some errors because of some msgboxes variables that i have not defined.

    So, if you think that "Option Explicit" will solve this problem, i'll define everything, but only if necessary, because the code is very big it this will make me spend too much time...

    Thank you very much for the attention!

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    From now until the end of time, I recommend that you put Option Explicit at the top of every module before writing a line of code. The VBE will do this automatically for you if you do Tools > Options, and check Require Variable Declaration.

    Undeclared variables (sans Option Explicit, which doesn't allow them) are Variants, and their type can change dynamically.

    To your current problem, set a breakpoint on that line of code, and in the Immediate window, do

    ? TypeName(rei)

    for each variable in the formula and see what it is.

    What is the error type when the code breaks?

  9. #9
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189
    Hi!

    Thanks for your reply!
    As i posted before in my code, that variables were defined by me as Double.
    But yet i've tried what you said and it reported me, for each one: "Double".

    I think that the error occurs specificly when i use a value in a Userform that makes some error in the claculation. But either ways, with that numeric values presented by me at first (even if they are correct for what i want), nui should present a reasonable number.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    What is the error type when the code breaks?

  11. #11
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189
    Hi! Sorry for just replying now, but yesterday i went home after work, so now that i returned, i hope that's not too late for you to help me.

    The error is:
    Run-time error '5':
    Invalid procedure call or argument

    Thanks

+ 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