Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - using variables in object names

Status
Not open for further replies.

kaplin

Programmer
Mar 14, 2003
11
CA
I'm new to forms - how do I use a variable when calling a series of checkboxes.

Ex:

dim count as integer
dim titles(20) as string

for count = 1 to 20
titles(count) = myForm."checkbox" & count.caption
next count
 
No can do. This is so common, someone should write a FAQ! Usually the solution is something like

dim count as integer
dim titles(20) as string
dim ctrl as object

for each ctrl in myForm.controls
if left(ctrl.name)="checkbox" then
titles(val(mid(ctrl.name,9))) = ctrl.caption
end if
next ctrl
Rob
[flowerface]
 
Wow - and to think it sounds like such a simple question!

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top