+ Reply to Thread
Results 1 to 10 of 10

Division by zero

  1. #1
    Registered User
    Join Date
    07-21-2015
    Location
    Monterrey, México
    MS-Off Ver
    MAC 2011
    Posts
    6

    Division by zero

    Sup,

    I have a problem in this code:

    Please Login or Register  to view this content.
    It returns values from the general equation formula, but when the inner loop is finished once, it says that there is a division by zero and the program highlights the j variable. Using the watch feature, I get j's value as 2.

    Any help will be really grateful.

    Thanks
    Last edited by raulge91; 07-21-2015 at 06:47 PM. Reason: Noob

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

    Re: Division by zero

    Welcome to the forum, raulje.

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    07-21-2015
    Location
    Monterrey, México
    MS-Off Ver
    MAC 2011
    Posts
    6

    Re: Division by zero

    I am really, sorry. Thanks for the comments.

    I am editing the post.

  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

    Re: Division by zero

    Thank you.

    You don't include your variable declarations or initialization, so it's impossible to guess where the problem lies. On what line does the error occur, and what are the values of all relevant variables?

  5. #5
    Registered User
    Join Date
    07-21-2015
    Location
    Monterrey, México
    MS-Off Ver
    MAC 2011
    Posts
    6

    Re: Division by zero

    I suppose that the relevant variables here are:

    PS(i); PS(1)= 1 & PS(2)=4;
    Segmentos=2 ;
    Per= 5.

  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

    Re: Division by zero

    And ... ?

  7. #7
    Registered User
    Join Date
    07-21-2015
    Location
    Monterrey, México
    MS-Off Ver
    MAC 2011
    Posts
    6

    Re: Division by zero

    The error is given at line: 163.

    Right after the first loop is completed. It is strange, before the last time I ran the code it didn't show me the error. I am running it and happened now, but not the last time...

    Is there any other information that I can give you for you to give me a better advice?

  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

    Re: Division by zero

    Raul, from what you have posted, how would I know what line 163 is?

  9. #9
    Registered User
    Join Date
    07-21-2015
    Location
    Monterrey, México
    MS-Off Ver
    MAC 2011
    Posts
    6

    Re: Division by zero

    Sorry, I am getting used to forums. I'll try my best to be more thorough. Here is the complete code:

    Please Login or Register  to view this content.
    Thanks

  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

    Re: Division by zero

    A Next statement cannot generate a run-time error.

    What happens when you step through the code?

+ 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. #DIV/0! without any division!!!
    By JudiK in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-04-2013, 08:43 PM
  2. division gives wrong answer (division)
    By Brice in forum Excel General
    Replies: 5
    Last Post: 12-24-2010, 10:13 PM
  3. Division
    By samjs in forum Excel General
    Replies: 3
    Last Post: 02-22-2010, 02:01 AM
  4. Help with division
    By Twyko in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-11-2009, 04:48 PM
  5. Division by Zero
    By scotfitz in forum Excel General
    Replies: 5
    Last Post: 06-15-2008, 06:20 PM
  6. Need help with division, please!!!
    By swag143 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-16-2006, 12:05 PM
  7. [SOLVED] Division
    By David in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 07-26-2006, 06:05 AM
  8. [SOLVED] Division By Zero
    By carl in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-27-2005, 01:05 PM

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