Long vs. Integer

By in Uncategorized on .

Once upon a time I read that Excel does not use the Integer data type internally. If you use the Integer data type in your code, Excel will convert it to a Long, so you might as well just use Long. It still produces an overflow error if you get outside the Integer bounds, I’ve noticed.

I haven’t used Integer in years because of this, but now I don’t recall who said it and when. It was certainly in a newsgroup post, but I couldn’t google it very easy. Does anyone know if this is true?

6 thoughts on “Long vs. Integer

  1. Ivan F Moala

    Thats because Integers are actually converted in the underlying VB Engine. The compilied code is 32 bit, so using Longs skips the under the hood conversion.

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax