ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Building object reference (https://www.excelbanter.com/excel-programming/321539-building-object-reference.html)

Zsola

Building object reference
 
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

Tom Ogilvy

Building object reference
 
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

"zsola" wrote in message
...
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




Bob Phillips[_6_]

Building object reference
 
For i = 1 to 10
Me.Controls("TextBox" & i).Text = i
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"zsola" wrote in message
...
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




zsola

Building object reference
 
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

"zsola" wrote in message
...
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



.



All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com