validation in frame VBA

VBAmalta89

Board Regular
Joined
Mar 25, 2011
Messages
116
I have a series of 8 frames in a user form. The user has the option to activate any number of frames by inserting the value in a text box.

Withing each frame are a number of check boxes, adjacent to which are text boxes. i would like to create a validation procedure so that when the user clicks teh done button all text boxes adjacent to a checked check box have a value within them.

Any idea how to do this?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You could make life a lot easier if you're methodical about the names you give to the checkboxes and text boxes.

Then you could use something along the lines of:

Code:
Sub test()
    i = 0
    For x = 1 To 10
        If Controls("checkbox" & i) Is True And Controls("textbox" & i).Caption <> "" Then i = i + 1
    Next x
    If i = 10 Then MsgBox "All Valid"
End Sub

HTH
 
Upvote 0
in fact they are labelled methodically as follows:

the 8 frames are frame1 to frame 8.

the text boxes in frame 1 are power1_1 to power 20_1
the text boxes in frame 2 are power1_2 to power 20_2
and so on..

the check boxes in frame 1 are process1_1 to process20_1
the check boxes in frame 2 are process1_2 to process20_2
and so on..

How can i make the procedure repeat for all enabled frames and for all text boxes corresponding to the enabled check boxes?
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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