Building object reference

  • Thread starter Thread starter zsola
  • Start date Start date
Z

zsola

Hi Experts,

My question is, how can I refer to objects(eg. textboxes)
in a for..next cycle, for instance something like this:

for i=1 to 10

(textbox & i).text=Cstr(i)
'where (textbox & i) is for representing
'textbox1...textbox10

next i

Thanks in advance:
Zsola
 
textboxes from the control toolbox toolbar
on a userform

for i = 1 to 10
userform1.Controls("Textbox" & i).Text = ""
Next

on a Worksheet
for i = 1 to 10
activesheet.OleObjects("TextBox" & i).Object.Text = ""
Next


Textboxes from the drawing toolbar
for i = 1 to 10
Activesheet.Textboxes("Textbox" & i).Value = ""
Next
 
For i = 1 to 10
Me.Controls("TextBox" & i).Text = i
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Thanks. this is the solution.
-----Original Message-----
textboxes from the control toolbox toolbar
on a userform

for i = 1 to 10
userform1.Controls("Textbox" & i).Text = ""
Next

on a Worksheet
for i = 1 to 10
activesheet.OleObjects("TextBox" & i).Object.Text = ""
Next


Textboxes from the drawing toolbar
for i = 1 to 10
Activesheet.Textboxes("Textbox" & i).Value = ""
Next
--
Regards,
Tom Ogilvy




.
 
Back
Top