Thread: Variable Name
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Variable Name

Hi
use an array variable. e.g.
dim name(1 to 3) as string
dim i
name(1)="test1"
name(2)="test2"
name(3)="test3"
for i = 1 to 3
msgbox name(i)
next


-----Original Message-----
Hi,

a little problem.

How can I access to my variables in a loop

Ex :

Dim Name1 as string
Dim Name2 as string
Dim Name3 as string

sub Test

Name1 = "X"
Name2 = "Y"
Name3 = "Z"
For i = 1 to 3
msgbox(*Name & i*) 'should display X then Y then Z
Next i
End Sub


---
Message posted from http://www.ExcelForum.com/

.