Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
mrt mrt is offline
external usenet poster
 
Posts: 70
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default 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
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
Declaring Variables matt_steer[_2_] Excel Programming 2 May 17th 04 09:53 PM
DEclaring variables Pedro Excel Programming 1 November 13th 03 05:02 PM
Declaring variables Pedro Excel Programming 1 November 13th 03 03:32 PM
DEclaring variables Pedro Excel Programming 2 November 13th 03 11:54 AM
Declaring Variables chris brunt Excel Programming 2 August 4th 03 02:02 PM


All times are GMT +1. The time now is 04:46 PM.

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"