Norm: the 2 areas I had problems with declarations of variable is Reading
worksheet cells and passing variables between subroutines and between
functions.
When you are reading cells that have number and strings a you try to read
these values into a variable you will get errors if youdeclare the variable a
number , string or even variant. I also have had problems passing arrrays
between functions and trying to declare the variable type of the array.
I just got tired of having to fight excel with delcaring variables and then
wasting a lot of time finding if I simply removed the declaration it worked.
thje documentation of excel is poor and there just seems to be a lot of
annomolies that takes lots of experience and lots of time to figure out. I'm
just very tired of having excel waste my time like declaring a variable and
then find out later the declaration was causing the error.
Norm, some day you will eat your words and agree with me!
"Norman Jones" wrote:
> Hi Jim,
>
> '----------------
> I have some questions:
> 1. You didn't declare any variables. When can you get away with this?
> '----------------
>
> IMHO, all variables should always be declared explicitly.
>
> In this connection. you might wish to see Chip Pearson at:
>
> Using Variables (Properly) In VBA
> http://www.cpearson.com/excel/variables.htm
>
> Unlike Joel, I have never experienced problems as the
> result of the declaration of variables. I should be intrigued
> to see an example of an error caused by explict declaration.
>
> '---------------
> 2. I've never seen the use of a Column name in a Cell variable. eg
> Cells(RowCount - 1, "G"). It works, so I guess I really don't need to know
> why - but i've never seen it documented...
> '----------------
>
> The ColumnIndex argument can be either a string or a number:
> see VBA help for the Item property of a range object: see VBA
> help on the Item property of a range object.
>
>
> ---
> Regards,
> Norman
>
>
>