good coding practice question
Hello,
Is it good practice to dim statements at the top of a sub/function even if they are only used under certain circumstances?
Example 1
Private sub abc_click(index as integer)
Dim intAbc as integer
select case index
case 1
for intAbc = 1 to lstcount
debug.print "hello"
next intAbc
Case 2
debug.print "hello"
End select
or this:
Private sub abc_click(index as integer)
select case index
case 1
Dim intAbc as integer
for intAbc = 1 to lstcount
debug.print "hello"
next intAbc
Case 2
debug.print "hello"
End select
The second example would be the most memory efficient way, but is that the way to do it?
Thanks
Rick