Posts by Musicboi

    Posting this again as I need some VBA help


    What I would like it to do is as follows:


    1. At Opening the file, by default, Questions 1.3-1.11 should be hidden, also Worksheet Detailed Q to be hidden
    2. the answer to 1.11 should be blank at the start so 5.1 - 5.9 in the Detailed Questionnaire should also be hidden (somewhat what the code I have added in the Pre Q does)
    3. If answer for 1.2 is Yes, then I want 1.3-1.11 she be shown for answering AND The Detailed Q sheet to be visible now
    4. If 1.11 is C, then the Questions 5.1 - 5.9 on Detailed Q shown now


    An aside point, I have Radio buttons on my actual questionnaire, but when the rows are hidden they don't hide with the hidden rows - its weird. Any tips?

    Hi both,


    Thanks for your inputs. Attached is a demo file (i can't share the exact file due to sensitivity).


    You can see the VBA I have (in the Pre Questionnare) that hides rows in the detailed questionnaire


    What I would like it to do is as follows:


    1. At Opening the file, by default, Questions 1.3-1.11 should be hidden, also Worksheet Detailed Q to be hidden
    2. the answer to 1.11 should be blank at the start so 5.1 - 5.9 in the Detailed Questionnaire should also be hidden (somewhat what the code I have added in the Pre Q does)
    3. If answer for 1.2 is Yes, then I want 1.3-1.11 she be shown for answering AND The Detailed Q sheet to be visible now
    4. If 1.11 is C, then the Questions 5.1 - 5.9 on Detailed Q shown now


    An aside point, I have Radio buttons on my actual questionnaire, but when the rows are hidden they don't hide with the hidden rows - its weird. Any tips?

    Hello,


    I have 2 worksheets - both have a row of questions. Sheet 1: Pre-Questionnaire, Sheet 2: Detailed Questionnaire (Sheet 2 starts off hidden)


    • Sheet 1 has a row of 11 questions.
    • I want the first two questions on that to show upon opening the questionnaire.
    • The second question has a Yes, No option, If Yes selected, I want the other 9 questions (rows to be made visible) AND Sheet 2 to also be now visible
    • Question 11 has a list of answers, if answer "C" is selected, I want questions (rows) in Sheet 2 from 69-80 to be unhidden.


    I have the code working for the last part - but I am struggling to get the other two evaluations to work. Code for part 2 I am using is this:


    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$C$25" Then
    If Target.Value = "C" Then
    Sheets("Detailed Questionnaire").Rows("69:89").EntireRow.Hidden = False
    Else
    Sheets("Detailed Questionnaire").Rows("69:89").EntireRow.Hidden = True
    End If
    End Sub