J
Jan Nordgreen
I am using Excel 97.
As fas as I understand VB in Excel does not have control arrays, no controls
have an index property.
On a form I have seven labels called lbl1 to lbl7. I would like to set their
captions to a(i) where a is an array and i runs from 1 to 7.
The code below does not work:
for i = 1 to 7
labelname = "lbl" & format(i)
&labelname.caption = a(i)
next
but is there a way to construct the name of the control as a string, and
then use it?
I would hate to have to say:
lbl1.caption = a(1)
lbl2.caption = a(2)
etc
Any help is greatly appreciated.
Sincerely,
Jan Nordgreen
As fas as I understand VB in Excel does not have control arrays, no controls
have an index property.
On a form I have seven labels called lbl1 to lbl7. I would like to set their
captions to a(i) where a is an array and i runs from 1 to 7.
The code below does not work:
for i = 1 to 7
labelname = "lbl" & format(i)
&labelname.caption = a(i)
next
but is there a way to construct the name of the control as a string, and
then use it?
I would hate to have to say:
lbl1.caption = a(1)
lbl2.caption = a(2)
etc
Any help is greatly appreciated.
Sincerely,
Jan Nordgreen