Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default A Whole Lot a Dimming Going On

I apologize up front if this is a really dumb question.

My procedure [1 module/1 sub/900 lines (no comments)] involves 57 dim
statements.

Lots of variables, but it runs great. It just looks strange with all the Dim
statements.

Is that too many? Is it bad coding practice? Any tips to do handle it
better?

Thank you,
Robert


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default A Whole Lot a Dimming Going On

57 variables in 900 lines sounds like a lot, but without seeing your
code, it's hard to say whether it's too many.

If the code is for your use only, my philosophy is usually "if it runs
the way you want, it's correct".

If the code will need to be maintained by others, you're better off
using a more formal system.

One shortcut, which I usually don't recommend, but can save a lot of
Dim'g is to use a DefType statement. For instance, at the module level,
putting

DefStr S

will automatically type all variables starting with "s" or "S" as
strings, so

Dim sOne, sTwo, sThree, sFour

is equivalent to

Dim sOne As String
Dim sTwo As String
Dim sThree As String
Dim sFour As String

or

Dim sOne As String, sTwo As String, sThree As String, sFour As String


In article ,
"Robert Lerner" wrote:

My procedure [1 module/1 sub/900 lines (no comments)] involves 57 dim
statements.

Lots of variables, but it runs great. It just looks strange with all the Dim
statements.

Is that too many? Is it bad coding practice? Any tips to do handle it
better?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default A Whole Lot a Dimming Going On

That would work well for me because I have always used those very prefixes.
Great tip. Thanks.

-Robert

"JE McGimpsey" wrote in message
...
57 variables in 900 lines sounds like a lot, but without seeing your
code, it's hard to say whether it's too many.

If the code is for your use only, my philosophy is usually "if it runs
the way you want, it's correct".

If the code will need to be maintained by others, you're better off
using a more formal system.

One shortcut, which I usually don't recommend, but can save a lot of
Dim'g is to use a DefType statement. For instance, at the module level,
putting

DefStr S

will automatically type all variables starting with "s" or "S" as
strings, so

Dim sOne, sTwo, sThree, sFour

is equivalent to

Dim sOne As String
Dim sTwo As String
Dim sThree As String
Dim sFour As String

or

Dim sOne As String, sTwo As String, sThree As String, sFour As String


In article ,
"Robert Lerner" wrote:

My procedure [1 module/1 sub/900 lines (no comments)] involves 57 dim
statements.

Lots of variables, but it runs great. It just looks strange with all the
Dim
statements.

Is that too many? Is it bad coding practice? Any tips to do handle it
better?



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
dimming text shovelhead69 Excel Discussion (Misc queries) 1 June 13th 06 07:49 PM
Dimming Controls David Benson[_2_] Excel Programming 1 October 10th 03 09:49 PM


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

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"