Clearing 'Groups' Of Userform Controls (avoiding clearing all userform controls, or doing each individually)

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
In my userform, I have 10 frames each with a variety of controls (textboxes, comboboxes, check boxes) in each specific to that frame. Some frames have as little as 4 controls, others as many as 15.

Is there an efficient way that I can clear the values of each of these controls in just the frames (not the entire form) rather than having to code each control's property individually? Ihave this pseudo code below, but I suspect I can't simply isolate groups of controls based on their unique frame.

Pseudo code:

Rich (BB code):
With Me
    For frm = 1 to 10
        nameFrm = ? frame name of frm(i) ?   'eg frm2d_setup_exp10
        for each control in nameFrm 'loop through each of the 12 controls in frm2d_setup_exp10
            if control is a textbox value = false
            if control is a combobox or textbox value = ""
        next
    Next frm
End With
 
Last edited:

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,215,945
Messages
6,127,856
Members
449,411
Latest member
adunn_23

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