Check boxes in a form

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:18 PM GMT

Question

QUESTION: I have created a Form in Excel 2007, and have a number of check boxes to answer an array of questions. What I would like to do in the Form itself, is when certain questions are checked, follow up questions become un-hidden and they can check off sub-boxes.

Also if possible, when tabbing through the form, will the cursor stop on the hidden check boxes?

Scott

ANSWER: Scott, what do you mean by form? Do you mean a worksheet set up to look like a paper form or do you mean a Userform and you are using VBA.

if you mean a worksheet, what type of checkboxes. ActiveX or Forms controls. On a worksheet, there is no tabbing to checkboxes. On a worksheet, there is no making things visible unless you do it with a macro. How do you have your checkboxes hidden.

So if we are talking about code, are you looking for a generic example?

Please elaborate on what you want.


---------- FOLLOW-UP ----------

QUESTION: Thank you for the quick reply. I have created a Userform and am using VBA. A generic example that shows:

In a UserForm If checkbox1 is checked then show checkbox2.

Does that make sense?


Scott

Answer

Scott,

Private Sub CheckBox1_Click()

If CheckBox1.Value = True Then
    CheckBox2.Visible = True
Else
    CheckBox2.Visible = False
End If

End Sub

worked for me. It must go in the userform module

as far as tabbing, you can't tab to controls that have the visible property set to false. So I tested this and as long as checkbox2 was not visible, I tabbed past it. When it was visible, it was included in the controls that were tabbed to.

Advertisement

©2021 eLuminary LLC. All rights reserved.