Show or hide rows based on a cell
Solved
charlo78
Posted messages
34
Status
Member
-
charlo78 Posted messages 34 Status Member -
charlo78 Posted messages 34 Status Member -
Hello,
I am a newbie in VBA programming. However, I need help for my work. I am creating a form that needs to be dynamic (questions should appear or disappear based on the answers).
Here is my case:
On the questionnaire tab, I have my question and checkboxes "form" that return a value "True" or "False" in my "responses" tab in cell B6.
If B6 is True on my "responses" tab, I would like rows 60 to 97 of my "questionnaire" tab to be hidden.
If someone could help me by providing the programming, that would be really nice!
Thank you!
I am a newbie in VBA programming. However, I need help for my work. I am creating a form that needs to be dynamic (questions should appear or disappear based on the answers).
Here is my case:
On the questionnaire tab, I have my question and checkboxes "form" that return a value "True" or "False" in my "responses" tab in cell B6.
If B6 is True on my "responses" tab, I would like rows 60 to 97 of my "questionnaire" tab to be hidden.
If someone could help me by providing the programming, that would be really nice!
Thank you!
1 answer
-
Hello,
Code to put into a module and assign the macro to the checkbox by adapting the number
'Checkbox 1 Sub Checkbox1_Click() If ActiveSheet.Shapes("Checkbox 1").OLEFormat.Object.Value = 1 Then Worksheets("Questionnaire").Rows("60:97").EntireRow.Hidden = True Else Worksheets("Questionnaire").Rows("60:97").EntireRow.Hidden = False End If End Sub-
Thank you very much. It works! However, if I want to add a new conditional zone following this macro, what code should I write before copying and pasting your code, adapting the checkbox numbers and the rows to show/hide?
Basically, my first 3 buttons make the described area appear, my buttons 4 and 5 make another area appear, and buttons 5 and 6 another one again.
Thank you. -
-
-
-
-