View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams[_3_] Tim Williams[_3_] is offline
external usenet poster
 
Posts: 7
Default Create dynamic variable names?

If you want to reference items/values via "names" created at runtime then
try using a Dictionary object.
Creating variable names at run-time (even when it's possible) is usually not
the best approach to a problem.

Tim.

"J Kruger" wrote in message
m...
Hi,

I have been looking everywhere on how to create dynamic variables in

excel.
I want the same result as what the eval() function in JavaScript gives.

ie.

a1 = new Array(10);
a1[0] = "hello";
alert(eval("a" + 1)[0]);

or

for(i = 0; i <=10; i++){
eval("a"+i) = i;}

Any help would be appreciated.