Jason,
I don't believe you can (at least within the same sub)
and it probably isn't necessary...
If Counter = 1 Then
'do something
ElseIf Counter = 2 Then
'do something else
ElseIf Counter 2 Then
'take a break
End If
Also, you can also declare a variable at the top of a standard module.
Its value would then be available in all subs/function/modules...
Public Counter as Long
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
"Jason Paris"
wrote in message
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