Calling objects

  • Thread starter Thread starter Stewart
  • Start date Start date
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!!!)
 
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 *
 
Back
Top