ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling Text Boxes from a sheet (https://www.excelbanter.com/excel-programming/323668-calling-text-boxes-sheet.html)

Jordan

Calling Text Boxes from a sheet
 
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

Tom Ogilvy

Calling Text Boxes from a sheet
 
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.

--
Regards,
Tom Ogilvy

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




Jordan

Calling Text Boxes from a sheet
 
Thanks a lot Tom!!

"Tom Ogilvy" wrote:

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.

--
Regards,
Tom Ogilvy

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






All times are GMT +1. The time now is 10:31 AM.

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