+ Reply to Thread
Results 1 to 5 of 5

Overflow Error: Number larger than Long

  1. #1
    Registered User
    Join Date
    07-18-2009
    Location
    Waterloo, Canada
    MS-Off Ver
    Excel 2020
    Posts
    20

    Overflow Error: Number larger than Long

    Hi,

    I am trying to implement a Macro with functions which uses phone numbers.

    Now the phone numbers have to be used without seperators ie 949-223-0091 won't work - its has to be 9492230091.

    Now as you can see this number is outside the range for Long (largest: 2147483647).

    So is there anything larger than Long that I can assign such a number to?

    I would use a string, but I need it as a number for using autofill function (shown below):

    Please Login or Register  to view this content.
    My macro is complete except this small problem lol.

    Any help is appreciated.

    Thanks!

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

    Re: Overflow Error: Number larger than Long

    Try a Double.

    EDIT: Strike that. What are you trying to do? Even Excel 2007 has only 1M rows -- you're not filling anything down anywhere close to the range of a Long.
    Last edited by shg; 07-21-2009 at 07:34 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    07-18-2009
    Location
    Waterloo, Canada
    MS-Off Ver
    Excel 2020
    Posts
    20

    Re: Overflow Error: Number larger than Long

    Well I don't need 1M rows. The program needs to check a range of phone numbers eg 9792012000 to 9792012999.

    So at most I will need only 1000, maybe 10000 (rare).

    However when I need to autofill I have to put a value in the first cell, from where the filling starts. Now that value is greater than a Long, which is why the overflow is popping up.

  4. #4
    Registered User
    Join Date
    07-18-2009
    Location
    Waterloo, Canada
    MS-Off Ver
    Excel 2020
    Posts
    20

    Re: Overflow Error: Number larger than Long

    OK I got it.

    Since for calculation for the autofill range I was only using a difference that was around 1000, I calculated that directly from the cell as an Integer.

    For copying to cells (and putting in a matrix, also part of the program), I just changed it from Long to String. Even though it outputs as text cells, it works.

    Thanks for the help though.

    Cheers!

  5. #5
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Overflow Error: Number larger than Long

    Typing 'Long' in the VBE, clicking it, hitting F1 for help, and then looking at "See Also" "Data Types Summary" would have given you the answer for this one a lot easier...
    If you find the response helpful please click the scales in the blue bar above and rate it
    If you don't like the response, don't bother with the scales, they are not for you

+ 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