Share via

Making checkboxes invisible

Anonymous
2019-12-23T06:54:03+00:00

Hi,

I would be extremely grateful if anyone can help me!

When I 'group' or 'hide' checkboxes (form control) some of them can been still be seen.

I understand that you need to use VBA to make them invisible.

I have an example and I was wondering if anyone could solve my problem - I have a questionnaire where if the answer to Question 1 is 'True' then I want to hide questions Questions 1(a), 1(b) and 1(c).

How would I be able to use VBA to solve this problem?

Here is the questionnaire example:

Here is what I would like the result to be (Questions 1(a), 1(b) and 1(c) are hidden):

Thanks very much!

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Andreas Killer 144.1K Reputation points Volunteer Moderator
2019-12-30T05:50:41+00:00

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

12 additional answers

Sort by: Most helpful
  1. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2019-12-23T13:00:29+00:00

    The problem with the form control is that they must be "inside" the cells to be hidden.

    Each CheckBox is also a Shape and a Shape has a property called TopLeftCell which returns the cell where the CheckBox belongs to.

    When you "align" the Checkboxes to the right cells you can simply hide the rows, and the Checkboxes will hide too.

    https://www.dropbox.com/s/dpx905d417lcu14/e8a46696-a633-494b-adef-d9638313da3f.xlsm?dl=1

    Merry Christmas, Andreas.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2019-12-23T10:14:10+00:00

    When you put the code. please replace "CheckBox1.Value = True" to the name of your checkbox. To get the name of your checkbox, right click on it and select properties. you will be able to see the name. (see screenshot). Then make sure to copy the name and replace it on your code in Module 1

    Let me know if you need more help.

    Fritzie

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2019-12-23T07:27:25+00:00

    Hi Fritz,

    Thanks very much!

    I'm new to VBA. I copied this code into 'Module 1' and it says 'Run-time error '424'. Object required'. Are you able to advise me further as to what I need to do? Thanks again!

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2019-12-23T07:07:42+00:00

    Hello,

    Thanks for reaching out. I'm Fritzie, an Independent Advisor. I'll be happy to help you out today.

    You can use this vba code on your 1st Checkbox

    Private Sub CheckBox1_Click()

    If CheckBox1.Value = True Then

    [5:8].EntireRow.Hidden = True

    Else: [5:8].EntireRow.Hidden = False

    End If

    End Sub

    Hope this helps! If this is not what you are looking for, please reply and let us know and we would be glad to look into providing more solutions!

    Have a nice day !

    Regards,

    Fritz

    Was this answer helpful?

    0 comments No comments