+ Reply to Thread
Results 1 to 22 of 22

hiding unhiding rows macro hierarchy

Hybrid View

dgibney hiding unhiding rows macro... 09-29-2014, 06:35 PM
natefarm Re: hiding unhiding rows... 09-30-2014, 05:56 PM
dgibney Re: hiding unhiding rows... 09-30-2014, 06:14 PM
natefarm Re: hiding unhiding rows... 10-03-2014, 05:29 PM
dgibney Re: hiding unhiding rows... 10-03-2014, 06:53 PM
natefarm Re: hiding unhiding rows... 10-06-2014, 09:33 AM
dgibney Re: hiding unhiding rows... 10-06-2014, 10:25 AM
natefarm Re: hiding unhiding rows... 10-06-2014, 03:57 PM
dgibney Re: hiding unhiding rows... 11-07-2014, 05:31 PM
dgibney Re: hiding unhiding rows... 11-07-2014, 05:33 PM
natefarm Re: hiding unhiding rows... 10-06-2014, 11:26 AM
dgibney Re: hiding unhiding rows... 10-07-2014, 05:37 PM
natefarm Re: hiding unhiding rows... 11-07-2014, 06:23 PM
dgibney Re: hiding unhiding rows... 11-07-2014, 06:30 PM
natefarm Re: hiding unhiding rows... 11-07-2014, 06:34 PM
natefarm Re: hiding unhiding rows... 11-10-2014, 11:22 AM
dgibney Re: hiding unhiding rows... 11-17-2014, 07:19 PM
natefarm Re: hiding unhiding rows... 11-18-2014, 12:19 PM
dgibney Re: hiding unhiding rows... 11-18-2014, 02:36 PM
natefarm Re: hiding unhiding rows... 11-18-2014, 03:10 PM
dgibney Re: hiding unhiding rows... 11-18-2014, 07:03 PM
natefarm Re: hiding unhiding rows... 11-19-2014, 01:44 PM
  1. #1
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    hiding unhiding rows macro hierarchy

    Depending on which goals are selected from pull-down menus in the “Goals” sheet this tool creates customized task lists by hiding or unhiding rows in the “Tasks” sheet. By selecting a button team members can sort their own tasks if a value (labor hours) has been entered into the appropriate task row and beneath their column. By pushing this button again all tasks and all team members columns are unhidden.
    PROBLEM: how to keep rows hidden or unhidden based on the selection in the pull-down menu in the “Goals” sheet. Please see attached document.The command to unhide all tasks unfortunately unhides all rows, including those that are hidden. Is there a line of code I can enter into the “DocTasksOnly” macro that will direct it to ignore hidden rows? Or, once the task list is filtered for a team member, is there a way to auto-refresh the hiding/unhiding of task rows? By selecting different goals and toggling the button back and forth you will better be able to understand the dilemma I've got myself into...
    Note that hiding/unhiding macros are provided only for “Doc” in this file example. In the final these macros will be replicated for each team member.
    Thanks for your help! David

    "Goals" code:
    HTML Code: 
    "Tasks" sheet code:
    HTML Code: 
    "Hide_Unhide_Task_RowsColumns" code:
    HTML Code: 
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    David, you will love or hate me after this, but I see several problems with your code and design -- partly because there is plenty of unnecessary code, and I always go for the cleanest and simplest approach, which is more efficient, and easier to maintain and understand. More importantly, you have a lot of hard-coded texts, row numbers, etc., and since I assume that these are just sample goals and tasks (as are the dwarf names), you would have to recode things, not only to make it production-ready, but every time goals, tasks, or dwarfs are added or changed. Writing generic code up front takes a little more design effort, but pays off greatly because it will work without maintenance thereafter.

    I'm working on some updates for you, but I'm done for the day, and will get back to you. I didn't want you to think you were being ignored.
    -Nate
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Smile Re: hiding unhiding rows macro hierarchy

    Nate, I absolutely do NOT hate you for your frankness. Until I started on the creation of this tool several months ago I had never written a macro. If I can get this tool to work it will help hundreds of people on design teams create better buildings. The actual tool has about 750 tasks and about a dozen team members. And perhaps 24 goals, each with pull-down menus. So, it's complex. FYI, it's not a tool we will sell, just share with teams to use as a project management aid.

    I look forward to seeing what you come up with and am very appreciative. Thank you Nate. David

    Psalm 8 (my favorite in the OT)
    John 11:35 (my favorite in the NT as it helps remind me how much He understands us.)

  4. #4
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    Sorry, it's been a busy few days and I haven't had much time with this. Question: If I understand correctly, you want to be able to pick the desired tasks for each goal on the Goal sheet, then have it keep those tasks visible and others hidden as you pick different employees on the Tasks sheet. Is the opposite also true (you pick an employee, and then select one or more tasks and the changes apply only to the selected employee)?

  5. #5
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: hiding unhiding rows macro hierarchy

    Here's ultimately my problem: the "Task" rows should stay hidden or revealed, depending on what "instructions" they receive from the "Goals" sheet worksheet change code. I've had problems with rows that were hidden being unhidden when sorting. My strategy was to try to re-trigger the worksheet change event (that initiates this hiding/unhiding)at the end of a series of macros, so that no matter what sorting of tasks (by person) only the correct tasks are ever revealed. It's almost like an issue of hierarchy: first the tasks must be established (hidden or not hidden). Then Only from those tasks that are not hidden can any hours be assigned. The hidden rows must always remain hidden (unless a different option is selected from the pull-down menu. In which case the hidden/unhidden rows auto-adjust). And, for what it's worth, the team member sorting should be only one person at a time OR the entire team. No two people's tasks (from the "unhidden" pool of tasks!) showing.

    Does that help describe what I'm looking to achieve? If not please let me know. Thanks again Nate for your willingness to help. I truly appreciate it! David

  6. #6
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    Partly. What I'm wondering is, let's say Happy selects Goal 1, Task A, then on the Tasks sheet, selects Happy. It now shows only Goal 1 Task A for Happy. If he goes back to Goals and selects Goal 1, Task B, then goes back to Tasks, should Happy still be selected, but now Task A is hidden and Task B for Happy is showing? I'm probably way off on the scenario.

  7. #7
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: hiding unhiding rows macro hierarchy

    I think you've got it, but let me elaborate, just to be sure... (And I apologize it's so confusing.)

    First, individual team members will not select which goals they want to pursue, the team will select them collectively. So, all team members will pursue only the pool of tasks that are not hidden in the "Tasks" sheet.

    Second, For each row usually only one team members will be assigning hours, but not all. What's important is for the rows of tasks that are supposed to be revealed are always revealed except when a team member is filtering the list to only see those (revealed)tasks for which they have hours assigned in their column.
    Third, when they've done this and want to un-filter the rows (by clicking the black "Show All Team Tasks" button) only those tasks that should be revealed are revealed. I've had problems with the Worksheet change macro not re-directing the hiding or unhiding or rows correctly when clicking this black button.

    Another way to look at it is a matter of hierarchy. After any filtering/unfiltering there should be a routine to verify that only the correct rows are revealed per what was selected in the "Goals" sheet.

    Thanks again Nate! David

  8. #8
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    I didn't need to insert a column B, since it was already blank. See if this will be a good start for you.

    Instead of buttons on each column, I added a combo box (cboEmpList) to select the employee you want. It is populated from a list on a new Employees sheet, which you will need to maintain to match the names in TASKS row 1.

    Select the desired tasks on the GOALS sheet, then switch to TASKS and pick the desired employee. The showing/hiding of rows and columns is triggered by the TASKS WorksheetActivate event, as well as by the cboEmpList_Change event. The code should work automatically as is when you add new goals/tasks in GOALS columns B:J, and as you add/change/delete employees on TASKS and Employees. However, if you add or change goals/tasks, then switch to the TASKS sheet, it may display error messages trying to find them (until you get them added there also).

    Have fun.

    Dwarfs.xlsm

  9. #9
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: hiding unhiding rows macro hierarchy

    Hi Nate, I apologize for being absent for a month. I had a heavy task placed on me and couldn't spend time on this. I have a few questions for you. The tool that I'm building has enough goals that in the preferred format they are arranged in two "columns" to fit an 8.5 X 11 cleanly. Please take a look at the "Dwarf Scorecard" attachment to get an idea of what the finished product is intended to look like. I need your help figuring out how to allow two "columns" of goals, with tasks. There are also a few features that I did not describe to you, any of which may interfere with your code. (I really like your solution, BTW. Thanks.) Could you please take a look at these below and let me know if you see any issues?

    The first feature is that each goal is assigned credit points in Yes|Maybe|No columns and these points are tallied to provide a final score. There are a maximum number of points possible for each goal and these are listed in columns "I" and "S". Now take a look at the second attachment "Dwarf point control". When the total number of points in any row does not equal the Possible Point value, all three cells (Yes|Maybe|No) are orange. When the point tally does equal the Possible Points these cells are light green. This is the macro I used to achieve this:
    Sub Section1Code(Target)
    Dim a As Double
    a = Application.WorksheetFunction.Sum(Range("B7:D7"))
    If a < Range("I7") Then
        Range("B7:D7").Interior.Color = RGB(255, 165, 0)
        Else
    If a = Range("I7") Then
        Range("B7:D7").Interior.Color = RGB(216, 228, 188)
            End If
        End If
    End Sub
    If the total points exceed the value an error message pops up. This is via Data Validation.

    Finally, to limit the scorecard to just show the goals and credit point distribution I've inserted a button to open or close columns "J" and "T". The code for that is straightforward:
    Private Sub CheckBox1_Click()
    If Sheets("SCORECARD").CheckBox1.Value = False Then
        Call Hide_JT
        End If
    If Sheets("SCORECARD").CheckBox1.Value = True Then
        Call Unhide_JT
        End If
    End Sub
    Sub Hide_JT()
    ActiveWorkbook.Sheets("SCORECARD").Columns("J").EntireColumn.Hidden = True
    ActiveWorkbook.Sheets("SCORECARD").Columns("T").EntireColumn.Hidden = True
    End Sub
    Sub Unhide_JT()
    ActiveWorkbook.Sheets("SCORECARD").Columns("J").EntireColumn.Hidden = False
    ActiveWorkbook.Sheets("SCORECARD").Columns("T").EntireColumn.Hidden = False
    End Sub
    I also made the pull-downs auto-reveal so clicking on the side button isn't required. Code:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
        Dim ValidationType As Variant
        
        If Target.Cells.Count = 1 Then
            If Not Intersect(Range("J:J,T:T"), Target) Is Nothing Then
                On Error Resume Next
                ValidationType = Target.Validation.Type
                On Error GoTo 0
                If Not IsEmpty(ValidationType) Then
                    Application.SendKeys "%{DOWN}"
                End If
            End If
        End If
                
    End Sub
    Would you mind taking a stab at expanding the original Dwarf document to include two "Columns" and the credit point columns? For it's worth this "Scorecard" will be the final format in terms of total columns and rows. The total number of affiliated Tasks is over six hundred.

    Thanks Nate. I really appreciate any direction you can provide. David

  10. #10
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: hiding unhiding rows macro hierarchy

    Oops, here are the attachments. Sorry.
    Attached Images Attached Images

  11. #11
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    Ok, one more thing. On your original example wkbk, you have Goal/Task selectable on the GOALS sheet (eg, Goal 1, Task A), and on TASKS you have the same goals/tasks, but with sub-tasks (Goal 1, TaskA1; Goal1, TaskA2, etc.) For a generic solution, you would need a way of linking these sub tasks with their goal/task. I suggest inserting a new column B on TASKS for the sub-task name. So, cells A5 & A6 would have "Goal 1, Task A", B5 would have "A1", B6 would have "A2", etc. Then when you select Goal 1, Task 1, the code would have something to look for in Column A. Would that work for you?

  12. #12
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: hiding unhiding rows macro hierarchy

    Hi Nate. Sorry for my delayed response. I've been tasked with something urgent and due for this Friday. I played around with your solution. Very interesting! Yes, I think it will work, but I may end up hiding a few of the referenced lists. The final product I am creating has about 30 tasks and each will have 1-5 options, with about 650 total rows of individual tasks to hide/unhide. Let me take a week and see if I can (1) figure out what your code is doing (and thanks for the notes, BTW) and (2) see if I can get to work on a bigger scale. I will get back to you in about a week. THANK YOU so much for this!
    David

  13. #13
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    Unfortunately I'm unable to see your attachments. They just show up as a black X with no functionality. I've seen this before but don't know what to do about it. It's hard to provide code blind. Maybe you could attach a workbook with just the Goals sheet or something.

    Your checkbox1 code could be improved as this:
    Private Sub CheckBox1_Click()
        Columns("J").Hidden = Not CheckBox1.Value
        Columns("T").Hidden = Not CheckBox1.Value
    End Sub

  14. #14
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: hiding unhiding rows macro hierarchy

    Sorry about that. Here is the workbook without the Tasks sheet. (They're confidential...) The color switching feature in the "Yes|Maybe|No columns doesn't work now but you can always add the code I uploaded if you like.

    I will clean up the checkbox 1 code. It's always so interesting to see how people do things different with these macros.

    Thanks again Nate. David
    Attached Files Attached Files

  15. #15
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    Ok, I'll take a look at this next week.

  16. #16
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    David,
    You've clearly done a lot of work since the original, and understandably can't post private data. Since you're attachment doesn't include the Tasks sheet, which is where the code was that I had provided, I'm starting with my original code, and you'll need to make any adjustments. The following has the original loop (now pointing to Scorecard instead of Goals, and with tasks in columns G instead of B), but instead of the column numbers being hard-coded, they are in a variable. When it hits the end of the first set, it resets the row & col numbers and continues on the 2nd set. I couldn't test, but it should be close.

    BTW, I didn't know Dwarves yodeled. I thought it was just the Hi Ho thing.

    Option Explicit
    Dim GoalTxt As String, TaskTxt As String, EmpTxt As String, EmpCol As Long
    Dim BegRw As Long, EndRw As Long, TaskEndRw As Long, GoalRw As Long, GoalCol As Long, Col As Long
       
    Private Sub Worksheet_Activate()
        With Sheets("SCORECARD")
            If .Range("SelectionChanged").Value = True Then
                .Range("SelectionChanged").Value = False
                Call ShowGoalsAndTasks
                Sheets("Employees").Range("EmpSelection").Value = "All Employees"
            End If
        End With
    End Sub
    
    Sub ShowGoalsAndTasks()
        Application.ScreenUpdating = False
    
        BegRw = 3
        GoalRw = 7
        GoalCol = 10 ' Col J
        Rows(BegRw & ":" & Rows.Count).Hidden = False
        TaskEndRw = Range("A" & Rows.Count).End(xlUp).Row
    
        ' Start with all rows hidden
        Rows(BegRw & ":" & TaskEndRw).Hidden = True
    
        With Sheets("SCORECARD")
            Do Until .Cells(GoalRw, GoalCol).Value = "" ' Loop through selected tasks
                GoalTxt = .Cells(GoalRw, GoalCol - 3).Value
                TaskTxt = .Cells(GoalRw, GoalCol).Value
                Do Until Cells(BegRw, 1).Value = GoalTxt Or BegRw > TaskEndRw
                    BegRw = BegRw + 1 ' Find selected goal
                Loop
                If BegRw > TaskEndRw Then
                    MsgBox GoalTxt & " goal not found."
                Else ' Found it
                    If TaskTxt = "Not Pursuing" Then
                        Rows(BegRw - 1).Hidden = False
                    Else
                        Rows(BegRw).Hidden = False ' Goal Name
                        BegRw = BegRw + 1
                        EndRw = BegRw
                        If TaskTxt = "Pursuing - Show All Tasks" Then ' Find the end of this goal section
                            Do Until Left(Cells(EndRw, 1).Value, 12) = "Not Pursuing" Or EndRw > TaskEndRw Or _
                              Cells(EndRw, 1).Value = .Cells(GoalRw + 1, 2).Value
                                EndRw = EndRw + 1
                            Loop
                        Else
                            Do Until Cells(BegRw, 1).Value = TaskTxt Or BegRw > TaskEndRw
                                BegRw = BegRw + 1 ' Find selected task
                            Loop
                            If BegRw > TaskEndRw Then
                                MsgBox TaskTxt & " task not found."
                            Else ' Found it
                                EndRw = BegRw + 1
                                Do Until Cells(EndRw, 1).Value <> TaskTxt
                                    EndRw = EndRw + 1 ' Find end of selected task
                                Loop
                            End If
                        End If
                        If Not BegRw > TaskEndRw Then
                            Rows(BegRw & ":" & EndRw - 1).Hidden = False
                        End If
                    End If
                End If
                GoalRw = GoalRw + 1
                If .Cells(GoalRw, GoalCol).Value = "" And GoalCol = 10 Then ' Start next set of columns
                    GoalRw = 7
                    GoalCol = 20 ' Col T
                End If
            Loop
        End With
    
        ' Start with all employee columns visible
        Columns("C:AZ").Hidden = False
    End Sub

  17. #17
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: hiding unhiding rows macro hierarchy

    Thanks Nate, it's not quite working yet. The attached file is a shorter version of the spreadsheet screen shot I sent, with two columns of goals and options. I replicated your other inner workings per the first example you sent. The employee columns are hiding/unhiding correctly. I also expanded the team roster to include a few placeholders.

    The very first goal functions properly but everything past it remains hidden in the "Tasks" sheet. Could it be the empty row/cells that follow it are causing the problem? Also, please note that there are required Goals in red. These will have rows of tasks, always visible, and there is no pull-down menu of options for these required tasks. I hope this doesn't cause any hiccups.

    I added some NOTES in the "Scorecard" code to explain what some of the other features are supposed to do.

    If you can take a look through this hopefully the fix will be simple. I'm sure I'm missing something, probably elementary.

    As far as the Hi Ho yodel thing, you're correct. I made it up...

    I'm very grateful for your help. Thanks Nate. David
    Attached Files Attached Files

  18. #18
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    Yes, empty rows were not being handled, and it didn't recover well from missing goals or tasks either (for example, your Scorecard had "Required", but on Tasks, it was "Required Task". Replace the ShowGoalsAndTasks subroutine with this and try again. I highlighted the changes.

    Sub ShowGoalsAndTasks()
        Application.ScreenUpdating = False
    
        BegRw = 3
        GoalRw = 7
        GoalCol = 10 ' Col J
        Rows(BegRw & ":" & Rows.Count).Hidden = False
        TaskEndRw = Range("A" & Rows.Count).End(xlUp).Row
    
        ' Start with all rows hidden
        Rows(BegRw & ":" & TaskEndRw).Hidden = True
    
        With Sheets("SCORECARD")
            Do Until .Cells(GoalRw, GoalCol).Value = "" ' Loop through selected tasks
                GoalTxt = .Cells(GoalRw, GoalCol - 3).Value
                TaskTxt = .Cells(GoalRw, GoalCol).Value
                Do Until Cells(BegRw, 1).Value = GoalTxt Or BegRw > TaskEndRw
                    BegRw = BegRw + 1 ' Find selected goal
                Loop
                If BegRw > TaskEndRw Then
                    MsgBox GoalTxt & " goal not found."
                    BegRw = 3
                Else ' Found it
                    If TaskTxt = "Not Pursuing" Then
                        Rows(BegRw - 1).Hidden = False
                    Else
                        Rows(BegRw).Hidden = False ' Goal Name
                        BegRw = BegRw + 1
                        EndRw = BegRw
                        If TaskTxt = "Pursuing - Show All Tasks" Then ' Find the end of this goal section
                            Do Until Left(Cells(EndRw, 1).Value, 12) = "Not Pursuing" Or EndRw > TaskEndRw Or _
                              Cells(EndRw, 1).Value = .Cells(GoalRw + 1, 2).Value
                                EndRw = EndRw + 1
                            Loop
                        Else
                            Do Until Cells(BegRw, 1).Value = TaskTxt Or BegRw > TaskEndRw
                                BegRw = BegRw + 1 ' Find selected task
                            Loop
                            If BegRw > TaskEndRw Then
                                MsgBox TaskTxt & " task not found."
                                BegRw = 3
                            Else ' Found it
                                EndRw = BegRw + 1
                                Do Until Cells(EndRw, 1).Value <> TaskTxt
                                    EndRw = EndRw + 1 ' Find end of selected task
                                Loop
                            End If
                        End If
                        If Not BegRw > TaskEndRw Then
                            Rows(BegRw & ":" & EndRw - 1).Hidden = False
                        End If
                    End If
                End If
                If .Cells(GoalRw + 1, GoalCol).Value = "" Then
                    GoalRw = .Cells(GoalRw + 1, GoalCol).End(xlDown).Row
                Else
                    GoalRw = GoalRw + 1
                End If
                If .Cells(GoalRw, GoalCol).Value = "" And GoalCol = 10 Then ' Start next set of columns
                    GoalRw = 7
                    GoalCol = 20 ' Col T
                    If .Cells(GoalRw, GoalCol).Value = "" Then
                        GoalRw = .Cells(GoalRw + 1, GoalCol).End(xlDown).Row
                    End If
                End If
            Loop
        End With
    
        ' Start with all employee columns visible
        Columns("C:AZ").Hidden = False
    End Sub

  19. #19
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: hiding unhiding rows macro hierarchy

    We're almost there! Just one small issue. Please see attached version 3. In order for the Tasks rows to hide/unhide I have to change the EmpList checkbox listing on the Tasks sheet. Other than that it's working fine! Am I correct that we need to add some event to toggle the SelectionChange box to "False"? Right now it always reads "True"....If it makes this run smoother I can always add a one-line Data Validation list ("REQUIRED") for the Required Tasks. I tried it and it works but it didn't make any difference with the current updating/refreshing issue.

    This is very encouraging Nate. I've been plugging away on this for several months and you've been so helpful. Thank you. David
    Attached Files Attached Files

  20. #20
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    In your original sample, there was data in column B of Tasks. The code used that to determine if it was a task row or a goal row. For whatever reason, column B is now entirely blank, so it didn't work right anymore.

    In the Tasks sheet code module, in the cboEmpListChange event, find this:

                If Cells(EndRw, 1).EntireRow.Hidden = False Then
                    If Cells(EndRw, 2).Value <> "" Then
                        If Cells(EndRw, EmpCol).Value = "" Then
                            Rows(EndRw).Hidden = True
                        End If
                    End If
                End If
    and replace it with this:

                If Cells(EndRw, 1).EntireRow.Hidden = False Then
                    If Cells(EndRw, EmpCol).Value = "" Then
                        Rows(EndRw).Hidden = True
                    End If
                End If
    Hopefully everything else will still work like it should.

  21. #21
    Forum Contributor
    Join Date
    05-23-2014
    Location
    Fredericia, Denmark
    MS-Off Ver
    Windows Office 2013, Excel 10
    Posts
    139

    Re: hiding unhiding rows macro hierarchy

    Hmm, I don't think that fixes the problem, but, before making the deduction...do I need to add data in Column "B"? I played with it in earlier versions and it didn't seem to make any difference. If I do need to include data in column B is there a special sequence or exact matching text I need to be aware of? With this version (attached spreadsheet) when I click on the "Tasks" tab it still doesn't hide/unhide until I click on a different name. And, here's something interesting.....when I click on the "All Employees" entry it includes the Task title above each task, but whenever a team member is selected these titles are not revealed.

    Almost there...... Thanks Nate, I appreciate your patience with this weird set of issues. David
    Attached Files Attached Files

  22. #22
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: hiding unhiding rows macro hierarchy

    It appears you have deleted a bunch of code in the Tasks sheet code module. Go back to post #17 (or a backup copy of your own) to retrieve it, but after doing so, be sure to adjust for the changes to the ShowGoalsAndTasks subroutine in post #18.

    Regarding column B: In your original examples, on the Tasks sheet you had the goals and tasks in column A, and sub-tasks in column B. You still have goals and tasks in column A, but nothing in column B, which results in what appears to be duplicate tasks (such as the three "Required Task" entries under Clear Throat). If you were to put the sub-tasks back into column B, and then not apply the code changes from post #20, it would take care of the goal title not appearing for individual workers, but then all goal titles will appear, whether there any task numbers entered for that employee or not. If that's not ok, additional coding would be needed.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hiding/Unhiding rows
    By cool53 in forum Excel General
    Replies: 8
    Last Post: 10-25-2013, 02:31 AM
  2. [SOLVED] Hiding/Unhiding Rows
    By marcheese in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-26-2012, 10:25 AM
  3. Hiding/Unhiding Rows
    By marcheese in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2012, 11:56 PM
  4. Hiding and unhiding rows
    By Ranjani in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-18-2009, 02:37 AM
  5. Hiding/Unhiding rows
    By Arne Hegefors in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-21-2006, 03:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1