Calling objects

S

Stewart

I have some textboxes named TB1 thorugh to TB10. I want to
call these text boxes using a for-next loop. How can I
make this work? This is kind of what I want to happen, but
it obviously doesn't work...

for a =1 to 10
TB a .value="Whatever"
next a

Thank you for any help you can give me on this matter!!!

Stewart
MOS Excel Expert (not that it's doing me much good!!!)
 
R

Rob Bovey

Hi Stewart,

Here's one way to do it:

Dim lCount As Long
For lCount = 1 To 10
Me.Controls("TB" & CStr(lCount)).Value = lCount
Next lCount

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 

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