Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Data Type Declaration

Hi,

Do you choose the data type you will declare at the beginning of a
macro based on what range you know your values will be between?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Data Type Declaration

I generally declare my data types based on how I expect the code to execute
and to get the results I need.

"R Tanner" wrote:

Hi,

Do you choose the data type you will declare at the beginning of a
macro based on what range you know your values will be between?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Data Type Declaration

I use the most strict datatype that the values could possibly be for the
life of the program. My approach is realist-pessimist. What do the project
requirements need, but also what is the most far reaching possibility that
can occur as the client/project/data grows? It works quite well for me.
Overly-optimistic rules are the kiss of death of a program's functionality,
dooming a solution to a lifetime of support, IMO. (E.g. "We'll never have
more than 10,000 rows of data, so just use a short Int").

--
Tim Zych
www.higherdata.com
Compare data in worksheets and find differences with Workbook Compare
A free, powerful, flexible Excel utility


"R Tanner" wrote in message
...
Hi,

Do you choose the data type you will declare at the beginning of a
macro based on what range you know your values will be between?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Data Type Declaration

For numbers???

I use "As Long", never "As Integer".
I use "As Double", never "As Single".

No matter how small/large they may be.


R Tanner wrote:

Hi,

Do you choose the data type you will declare at the beginning of a
macro based on what range you know your values will be between?


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Data Type Declaration

How about As Byte?
I understand there is no point in using Integer instead of
Long as Long is faster (but maybe not measurable) than Integer plus
there is less chance of an overflow error.

RBS


"Dave Peterson" wrote in message
...
For numbers???

I use "As Long", never "As Integer".
I use "As Double", never "As Single".

No matter how small/large they may be.


R Tanner wrote:

Hi,

Do you choose the data type you will declare at the beginning of a
macro based on what range you know your values will be between?


--

Dave Peterson




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Data Type Declaration

Just so we are all on the same page... 16bit variables such as integers lose
their benefits since the systems all 32bit. There is actually extra overhead
to deal with an integer over a long... so long is more efficient.

--
HTH...

Jim Thomlinson


"Dave Peterson" wrote:

For numbers???

I use "As Long", never "As Integer".
I use "As Double", never "As Single".

No matter how small/large they may be.


R Tanner wrote:

Hi,

Do you choose the data type you will declare at the beginning of a
macro based on what range you know your values will be between?


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Data Type Declaration

I don't recall ever using "As Byte" either.

RB Smissaert wrote:

How about As Byte?
I understand there is no point in using Integer instead of
Long as Long is faster (but maybe not measurable) than Integer plus
there is less chance of an overflow error.

RBS

"Dave Peterson" wrote in message
...
For numbers???

I use "As Long", never "As Integer".
I use "As Double", never "As Single".

No matter how small/large they may be.


R Tanner wrote:

Hi,

Do you choose the data type you will declare at the beginning of a
macro based on what range you know your values will be between?


--

Dave Peterson


--

Dave Peterson
Reply
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
Use of Public for data declaration in Excel 2000 Gandalph Excel Programming 1 April 17th 08 06:47 PM
type declaration characters integreat Excel Discussion (Misc queries) 3 July 18th 06 04:31 PM
type declaration characters integreat Excel Discussion (Misc queries) 1 July 17th 06 10:02 PM
if declaration ashw1984 Excel Programming 2 January 30th 06 07:35 PM
Declaration? TJF[_2_] Excel Programming 5 December 18th 03 03:26 PM


All times are GMT +1. The time now is 02:23 AM.

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

About Us

"It's about Microsoft Excel"