Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Better Use of Dim statement
Hi,
I use Option Explicit in my code as best practise - however I end up with large numbers of lines of Dim statement for my variables... Dim sht_cont_temp1 As String, Sht_name As String, sht_name1 As String, etc etc is it possible to group all of the above variables something like... Dim (sht_cont_temp1, Sht_name, sht_name1) As String what do the pro's do...?? Thks...Chris |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Better Use of Dim statement
that syntax is not supported.
You have shown the method that is supported. There are some remnants from Basic that allow the use of symbols and implicit type declarations, but I don't believe the "pros" use these. -- Regards, Tom Ogilvy "Chris Gorham" wrote in message ... Hi, I use Option Explicit in my code as best practise - however I end up with large numbers of lines of Dim statement for my variables... Dim sht_cont_temp1 As String, Sht_name As String, sht_name1 As String, etc etc is it possible to group all of the above variables something like... Dim (sht_cont_temp1, Sht_name, sht_name1) As String what do the pro's do...?? Thks...Chris |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Better Use of Dim statement
Chris,
Unless you are declaring Variant type variables, you need an As Type clause for each variable. There are no shortcuts for declaring several variables to be the same type (other than the DefType statement). I tend to use the longest syntax of one Dim statement on one line for each variable. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chris Gorham" wrote in message ... Hi, I use Option Explicit in my code as best practise - however I end up with large numbers of lines of Dim statement for my variables... Dim sht_cont_temp1 As String, Sht_name As String, sht_name1 As String, etc etc is it possible to group all of the above variables something like... Dim (sht_cont_temp1, Sht_name, sht_name1) As String what do the pro's do...?? Thks...Chris |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Better Use of Dim statement
You can't do what you are suggesting from VBA.
In VB.NET, this is the way variables are declared. "Chris Gorham" wrote in message ... Hi, I use Option Explicit in my code as best practise - however I end up with large numbers of lines of Dim statement for my variables... Dim sht_cont_temp1 As String, Sht_name As String, sht_name1 As String, etc etc is it possible to group all of the above variables something like... Dim (sht_cont_temp1, Sht_name, sht_name1) As String what do the pro's do...?? Thks...Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions | |||
Help please, IF statement/SUMIF statement | Excel Worksheet Functions |