When I said "I always have them set up with variable declarations", I was
speaking specifically of Worksheet Change Events. And the reason is because
I got the basic code from VBA Help files or some posting in the forum, etc.
and never felt comfortable making a change to it. For anything I wrote
myself (*cough*...or pasted together myself, if you will), I never use
variable declarations in the Sub line.
However, your suggestion is noted - I will try to remember to post the code
if it seems necessary or helpful.
"Keith R" wrote:
> If you post your sub code, the group may give you better feedback on why
> that declaration might have caused the original problem.
>
> > I always have them set up with variable declarations in the Sub line (for
> > all I
> > know, that's the only way).
>
> As someone who's never had the formal training to know better, I do the
> opposite- I never set them up with variable declarations in the sub line,
> with the infrequent exception of functions or subs where I absoloutely need
> to pass data directly. I probably don't use it as often as I should (and
> perhaps not correctly when I do), but I definitely wouldn't throw them in
> unless you were intentionally going to pass a variable to that sub from a
> calling procedure.
>
> I look forward to reading some of the more expert replies on the subject.
>
> HTH,
> Keith
>
>
>
|