View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Smallweed Smallweed is offline
external usenet poster
 
Posts: 133
Default Variable Naming.....?

You can't do this as written but why not use an array (look them up in VBA
help to get the full info)?

Dim myArray(20)
Counter = 1
myArray(Counter)=???
Counter=2
myArray(Counter)=???
etc

"Jason Paris" wrote:

Hi all,

Just working on my first VBA code. A quick question please.......

When using a Counter, how can you create a Variable whose name is
based on the current value of the Counter?

For example:
________________________________________

First Iteration
***************
Counter = 1
Create a Variable whose name is 'VAR1'


Second Iternation
********************
Counter = 2
Create a Variable whose name is 'VAR2'


Third Iteration
***************
Counter = 3
Create a Variable whose name is 'VAR3'
________________________________________

I hope that makes sense.....!

Many thanks,

Jason Paris