Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
John,
The difference between an Integer and a Long is the amount of memory allocated for each and the largest number that such a variable can contain. An Integer is 2 bytes in length and, assuming signed values, can contain a number between -32,768 to 32,767. A Long is 4 bytes and can contain a number between -2,147,483,648 to 2,147,483,647. If you attempt to exceed these bounds, you'll get an overflow error. Neither an Integer nor a Long may contain fractional numbers (e.g., 1.234). The Single and Double data types are used for fractional numbers and these types differ in the range of the values that may be stored and the number of digits of precision (e.g., how many decimal places) the number may contain. Look in VBA Help (not Excel Help) for "Data Type Summary" for more information about the various data types and their limitations. Generally speaking, you should use Longs for integral values even if the given number will fit within an Integer or even a Byte. This is due to the fact that the CPU works in 32-bit (4 byte) "chunks" and must do additional conversions for Integer values. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting www.cpearson.com (email on the web site) "John" wrote in message ... What is the best way to def integer counters? I don't understand vb's definitions (Integer, long etc.). It used to be you used the def that used the least memory. Is that still true? for n = 1 to 100 what would you def n as for most efficiency and least memory use. Or isn't that a factor anymore? I am getting back into programming a little after 18 years. John |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2002 : Convert Positive Numbers to Negative Numbers ? | Excel Discussion (Misc queries) | |||
Need to reconcile numbers accounting Harlan Grove code doesn't work for negative numbers | Excel Programming | |||
Help! How do you get excel to find the x(changes daily, marked in a cell from another formula) highest numbers in a group of numbers and sum them up? | Excel Worksheet Functions | |||
Help! How do you get excel to find the x(changes daily, marked in a cell from another formula) highest numbers in a group of numbers and sum them up? | Excel Worksheet Functions |