Thread: Variable Name
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Leo Heuser[_3_] Leo Heuser[_3_] is offline
external usenet poster
 
Posts: 109
Default Variable Name

Hi

You have to use arrays in this situation:
Sub Test
Dim i As Long
Dim Name(1 to 3) As Variant

Name(1) = "X"
Name(2) = "Y"
Name(3) = "Z"
For i = 1 to 3
msgbox Name(i)
Next i
End Sub


--
Best Regards
Leo Heuser

Followup to newsgroup only please.

"LadaDriver " skrev i en
meddelelse ...
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/