Link to my example on excel:
ExampleforCommunityHelp.xlsx
First Problem:
I am wanting to have Heading's 3, 4, 5, and 6 collapsible to make it easier form information to be shown. I want them to start collapsed and upon "YES" indication in the J column they open.
Rows that always need to be visible:
1-13, 17, 23, 28, 33-end
Read the information from cell J13
BLANK = Closed
YES = Open rows - 14-16
Do not open any other rows
Read the information from cell J17
BLANK = Closed
YES = Open rows - 18-22
Do not open any other rows
**Continued with other two collapsible headings**
Required to work with any combination of the collapsible headings open. YES on Heading 2 and Heading 4 equals their rows opening, while No Input/Blank Heading 3 and Heading 5 stay collapsed.
Second Problem:
The table at the bottom I want to autofill.
If headings are left blank, they are deemed "Not Assessed" with an "X".
Any headings opened with "YES" are indicated as PASS or FAIL depending on column J inputs. Any one "F" indicated means FAIL (this includes all headings on the sheet). For example, if heading 3 and 4 are selected and each item has a "P" in J, then heading 6 must also have all "P" inputs in the J column in order to recieve a PASS. Heading 2 and 5 are Not Assessed and automatically have an "X" in the cells.
*P.S. if you know a solution for using the IF function and being blank until a value is entered that'd be helpful too. I've used the formula in J16 and am planning to use it for many cells, I just don't know how to build the formula.
Previous Help:
I was given this code previously but I have adjusted my sheet to more closely match the actual excel. I believe the problem with this coding is the 3rd Section of Unhide/Show the corresponding rows. As my rows are not all 3 rows wide. I don't know how to fix the code to work for me.
I have changed the cell inputs in my new document so the cell numbers used in this code are incorrect now, just as a note. I used data validation and conditional formatting in the "mark" and "result" columns - not sure if that was intended from the code but that's what is in the current sheet.
****************************************************************
Private Sub Worksheet_Change(ByVal Target As Range)
Dim checkCells As Range
Dim chk As Range
Dim j As Long, k As Long
Set checkCells = Range("J6,J10,J14,J18") ''' The range cells with Yes/No dropdown
If Not Intersect(Target, checkCells) Is Nothing Then
Application.ScreenUpdating = False
'' 1st- Hide all the data rows
Rows("7:9").EntireRow.Hidden = True
Rows("11:13").EntireRow.Hidden = True
Rows("15:17").EntireRow.Hidden = True
Rows("19:21").EntireRow.Hidden = True
''' 2nd Evaluate the value in each cell in the checkCells range
'' And show rows data only if the value is YES
For Each chk In checkCells
If UCase(chk.Value) = "YES" Then '''' 3rd -Unhide/Show the corresponding rows
chk.Offset(1).Resize(3, 1).EntireRow.Hidden = False
Else '''' Hide the corresponding rows and delete the Test results
chk.Offset(1, 0).Value = ""
chk.Offset(3, 0).Value = ""
End If
Next chk
End If
Application.ScreenUpdating = True
End Sub
*******************************************************************
I appreciate the help!