It's difficult to see what you are doing, and especially why it would work
in 2007, but not in 97. There might be a different incompatibility.
Essentially, you should not expect a spreadsheet (particularly a macro in a
spreadsheet) to be able to work with two versions of Excel so far apart.
You should not be looking at ways to use variables without declaring them
somewhere. They really should be declared, and then the compiler can assist
you in finding programming errors.
However, you should only declare variables in one place. If they need
global scope, make them public.