Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring variables (Long, String, Integer) and interpretation spe
Dear Colleagues,
Does anyone know which one of the two following ways to declare a string is faster for the VBA engine to read/interpret 1 = Dim MyVar$ 1 = Dim MyVar as String Thanks, Mr. T |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring variables (Long, String, Integer) and interpretation spe
If either is actually faster, which I doubt as they are both just reserving
memory space, it will be insignificant. What you do in the code itself will be far more important in terms of speed/performance. -- HTH RP (remove nothere from the email address if mailing direct) "MrT" wrote in message ... Dear Colleagues, Does anyone know which one of the two following ways to declare a string is faster for the VBA engine to read/interpret 1 = Dim MyVar$ 1 = Dim MyVar as String Thanks, Mr. T |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring variables (Long, String, Integer) and interpretation spe
In terms of working with the variables in the body of the program, all
else being equal, I would expect that working with a specific data type would be faster than working with a variant (which is what you get when you don't specify a type). It is also possible that working with Long may be faster than Integer and Double may be faster than Single, if VBA coerces them to the longer type for arithmetic operations and then back again. Jerry Bob Phillips wrote: If either is actually faster, which I doubt as they are both just reserving memory space, it will be insignificant. What you do in the code itself will be far more important in terms of speed/performance. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring variables (Long, String, Integer) and interpretation spe
Jerry,
What you say is absolutely correct, but has no bearing. Dim MyVar$ and Dim MyVar as String are both specific data types, both strings. -- HTH RP (remove nothere from the email address if mailing direct) "Jerry W. Lewis" wrote in message ... In terms of working with the variables in the body of the program, all else being equal, I would expect that working with a specific data type would be faster than working with a variant (which is what you get when you don't specify a type). It is also possible that working with Long may be faster than Integer and Double may be faster than Single, if VBA coerces them to the longer type for arithmetic operations and then back again. Jerry Bob Phillips wrote: If either is actually faster, which I doubt as they are both just reserving memory space, it will be insignificant. What you do in the code itself will be far more important in terms of speed/performance. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declaring variables (Long, String, Integer) and interpretation spe
So much for speed reading comphrehension as I am about to walk out the
door. Ouch :-( Bob Phillips wrote: Jerry, What you say is absolutely correct, but has no bearing. Dim MyVar$ and Dim MyVar as String are both specific data types, both strings. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Declaring Variables | Excel Programming | |||
DEclaring variables | Excel Programming | |||
Declaring variables | Excel Programming | |||
DEclaring variables | Excel Programming | |||
Declaring Variables | Excel Programming |