Concatenating to form Variables

T

Tezza

Hi
I am looking for a way to concatinate text in order to form a variable. So,
for example (see below) I might have 6 variables named similarly, and want
to assign a different value to each. Instead of spelling out each variable
on a seperate line of code, it would be neater, quicker and easier if I
could achieve this using an iterative loop, but I can't seem to get it to
work. Anyone got any ideas please.
Much appreciated.

Terry

Example:


Dim Line1, Line2, Line3, Line4, Line5, Line6 as integer
for i =1 to 6
"Line" &" i" =i * 10
next
Line
 
A

Andy Pope

Hi,

Seems an array would be a better option.

dim Line(1 to 6) as integer
for i =1 to 6
Line(i) = i * 10
next

Cheers
Andy
 
T

Tezza

Excellent!
Thanks Andy
Terry
Andy Pope said:
Hi,

Seems an array would be a better option.

dim Line(1 to 6) as integer
for i =1 to 6
Line(i) = i * 10
next

Cheers
Andy
 
K

Karl E. Peterson

Tezza said:
I am looking for a way to concatinate text in order to form a variable.

Sounds like you found a better way there, but...
Dim Line1, Line2, Line3, Line4, Line5, Line6 as integer

You are aware that only one of those variables is an Integer, right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top