+ Reply to Thread
Results 1 to 5 of 5

Macro throwing Overflow error when calculating

  1. #1
    Forum Contributor
    Join Date
    10-27-2013
    Location
    Columbus Ohio
    MS-Off Ver
    Excel 2010
    Posts
    137

    Macro throwing Overflow error when calculating

    Hello, I am trying to do a calculation in VBA that loops through cells and performs a calculation. However it keeps throwing an overflow error when it tries to divide the first two values. This is the error line and below is the function
    Please Login or Register  to view this content.
    Any thoughts as to why?
    Please Login or Register  to view this content.
    Last edited by jonboy6257; 12-01-2013 at 05:27 PM. Reason: Solved

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro throwing Overflow error when calculating

    It is probably one of the denominator figure is 0. You can not divide a number by zero.

  3. #3
    Forum Contributor
    Join Date
    10-27-2013
    Location
    Columbus Ohio
    MS-Off Ver
    Excel 2010
    Posts
    137

    Re: Macro throwing Overflow error when calculating

    I changed the direction of the division simple and got the division by zero error. I then changed the code to look like the following to account for the 0.
    Please Login or Register  to view this content.
    I am still getting the error. Is there another way U should check for 0 and skip it if so?

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro throwing Overflow error when calculating

    By zero, I mean including empty and blank cells.
    Yes, you can include an if statement to skip that cell if it is zero.

  5. #5
    Forum Contributor
    Join Date
    10-27-2013
    Location
    Columbus Ohio
    MS-Off Ver
    Excel 2010
    Posts
    137

    Re: Macro throwing Overflow error when calculating

    I realized I just left the value off in the second part of the AND statement so it wasn't checking what the second part was equal too. It seems to working correctly now. Thanks for the quick responses!

+ 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. [SOLVED] Help with Macro! Overflow Error
    By Abdiel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-13-2013, 09:02 PM
  2. Issue in macro getting overflow error
    By expert40 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2013, 11:43 AM
  3. Replies: 6
    Last Post: 11-29-2012, 08:56 PM
  4. Run Time Error 6: Overflow when calculating variable
    By PunPryde in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2011, 05:22 PM
  5. runtime error 6 overflow when running a macro
    By Kim in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2006, 12:45 PM

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