+ Reply to Thread
Results 1 to 4 of 4

Overflow Error

  1. #1
    Forum Contributor
    Join Date
    05-13-2009
    Location
    Lincoln, IL
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    237

    Question Overflow Error

    I'm getting an overflow error. I'm not sure I've defined x and y correctly. Basically, x and y are both input boxes where the user is going to enter a number. Then later on, those 2 numbers are added together in a formula. I had been getting #NAME?, and so I've been trying to adjust it and this is the latest version.

    Code was too long, so I'm attaching the file. It's in the frmRSCV code.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    04-14-2010
    Location
    NZ
    MS-Off Ver
    2007,2010
    Posts
    86

    Re: Overflow Error

    depending on the size of the number entered.. the Integer datatype may not be able to handle it.

    Integers can only handle a size of -32,767 to 62,767 - if your number is bigger than that, you'll get an overflow error.

    try declaring them as Long or Double datatypes

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

    Re: Overflow Error

    Your code does nothing with x or y after being initialized to the values from the input boxes.
    From Help:
    Integer (whole numbers) )variables are stored as 16-bit (2-byte) numbers ranging in value from -32,768 to 32,767
    Thats a small range. You seem to be working with money and so should be using SINGLE (decimals)
    ranging in value from -3.402823E38 to -1.401298E-45 for negative values and from 1.401298E-45 to 3.402823E38 for positive values
    Last edited by protonLeah; 07-10-2010 at 03:48 PM.
    Ben Van Johnson

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    21,528

    Re: Overflow Error

    If the entry is (as implied by Type) to always be numeric you may wish to investigate the use of Application.InputBox rather than InputBox which will give you added control regards data input (see Type)

+ 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