Loop through checkboxes within specified frame.

Paella1

Active Member
Joined
Mar 10, 2005
Messages
382
Is it possible to distinguish a checkbox that is inside a frame from one that is outside it? What I am trying to do is loop through all the checkboxes on a multipage but only those that are within a specified frame.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hello Paol:o,

Here is one way if you know the name of the frame on the multipage. This example checks Frame1 on Page 1 of the object Multipage1.
Code:
 Dim Ctrl As Control
 
  For Each Ctrl In Me.MultiPage1(0).Controls("Frame1").Controls
    If TypeName(Ctrl) = "CheckBox" Then
       X = Ctrl.Name
    End If
  Next Ctrl
Sincerely,
Leith Ross
 
Upvote 0
Leith,
Apologies for the late response, I was distracted by less important things.
It works a treat. Many thanks.
Paul
 
Upvote 0
Hi, sorry to dig up an old thread, but what if you do not know the name of the frame? I am facing a similar problem, but because i have dynamically created the frame, i have a whole host of frames to go through. How would i do this?

Thanks

Bolo
 
Upvote 0
If you know the checkbox, CheckBox1.Parent is the frame, page or userform that it is contained in. Perhaps something like

Code:
Dim knownBox as msForms.CheckBox
Dim Container as Object
Dim oneControl as Object

Set knownBox = Userform1.CheckBox23

For Each oneControl in KnownBox.Parent.Controls
    If TypeName(oneControl) = "CheckBox" Then
        MsgBox oneControl.Name & IIf(oneControl.Value, " is ", " is not ") & " checked."
    End If
Next
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,865
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top