LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default def numbers

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2002 : Convert Positive Numbers to Negative Numbers ? Mr. Low Excel Discussion (Misc queries) 2 November 6th 06 03:30 PM
Need to reconcile numbers accounting Harlan Grove code doesn't work for negative numbers [email protected] Excel Programming 1 July 28th 06 07:09 AM
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? C-Man23 Excel Worksheet Functions 3 January 19th 06 09:52 AM
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? C-Man23 Excel Worksheet Functions 1 January 9th 06 01:23 PM


All times are GMT +1. The time now is 07:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"