Calling Text Boxes from a sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello Everyone,
Ya know how when your dealing with a bunch of text boxes in a Userform
you can say:
For each textboxx in Controls
blaw blaw blaw

The problem I am having is that I'm dealing with a sheet not a userform and
there are a lot of controls on the page. is there a way to group text boxs
together so I can say:
For each textboxx in Group1.Controls, or something like that.

Thanks for the help,
Jordan
 
well, you can't say for each textbox in controls, in a userform.

you can say

for each ctrl in Userform1.Controls
if typeof ctrl is MSForms.Textbox then

end if
Next

on a worksheet you can do the same

Dim bx as MSForms.Textbox
for each obj in Activesheet.oleObjects
if typeof obj.Object is MSForms.Textbox then
set bx = obj.object

end if
Next

You could always create a collection and assign these to the collection if
you want.
 
Thanks a lot Tom!!

Tom Ogilvy said:
well, you can't say for each textbox in controls, in a userform.

you can say

for each ctrl in Userform1.Controls
if typeof ctrl is MSForms.Textbox then

end if
Next

on a worksheet you can do the same

Dim bx as MSForms.Textbox
for each obj in Activesheet.oleObjects
if typeof obj.Object is MSForms.Textbox then
set bx = obj.object

end if
Next

You could always create a collection and assign these to the collection if
you want.
 

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

Back
Top