Results 1 to 7 of 7

Show and hide rows on command

Threaded View

NMarien Show and hide rows on command 02-07-2011, 08:24 AM
DonkeyOte Re: Show and hide rows on... 02-07-2011, 09:11 AM
NMarien Re: Show and hide rows on... 02-07-2011, 09:35 AM
DonkeyOte Re: Show and hide rows on... 02-07-2011, 12:08 PM
NMarien Re: Show and hide rows on... 02-11-2011, 06:33 AM
DonkeyOte Re: Show and hide rows on... 02-11-2011, 08:48 AM
NMarien Re: Show and hide rows on... 02-14-2011, 10:56 AM
  1. #1
    Registered User
    Join Date
    02-07-2011
    Location
    Brussels, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    4

    Show and hide rows on command

    Dear all,

    For a task-list I made in excel I use a dropdown where users can choose their name, and see their personal tasks verry easy. (As it sometimes happend that on one job Member 1 is a junior, and on the other job Member 1 is a senior, I didn't want to work with the filter-system)

    I manage this true following code:

    Sub Personal_view()
        BeginRow = 3
        Col_junior = 39
        Col_senior = 40
        Col_manager = 41
        
        EndRow = Range("B65536").End(xlUp).Row
        For RowCnt = BeginRow To EndRow
            
        ' All team members - 1
        
        If Cells(1, 6).Value = "1" Then
        
               Cells(RowCnt, 1).EntireRow.Hidden = False
        
        End If
        
        ' Member 1
    
        If Cells(1, 6).Value = "2" Then
            
            If Cells(RowCnt, Col_junior).Value = "MB1" Then
               Cells(RowCnt, 1).EntireRow.Hidden = False
            Elseif Cells(RowCnt, Col_senior).Value = "MB1" Then
               Cells(RowCnt, 1).EntireRow.Hidden = False
            Elseif Cells(RowCnt, Col_manager).Value = "MB1" Then
               Cells(RowCnt, 1).EntireRow.Hidden = False
            Else
               Cells(RowCnt, 1).EntireRow.Hidden = True
            End If
        
        End If
        
        ' Member 2
    
        If Cells(1, 6).Value = "3" Then
            
            If Cells(RowCnt, Col_junior).Value = "MB2" Then
               Cells(RowCnt, 1).EntireRow.Hidden = False
            Elseif Cells(RowCnt, Col_senior).Value = "MB2" Then
               Cells(RowCnt, 1).EntireRow.Hidden = False
            Elseif Cells(RowCnt, Col_manager).Value = "MB2" Then
               Cells(RowCnt, 1).EntireRow.Hidden = False
            Else
               Cells(RowCnt, 1).EntireRow.Hidden = True
            End If
        
        Next RowCnt
        
    End Sub

    As I use my name 'Member 1', it displays exactly what I want; it hides all other lines.
    But if I want to go back, and choose for another member's name, the script doesn't work.

    Also when I want to show everyone's workload, I can't go back to this view...

    The fault is probably in the 'Cells(RowCnt, 1)' code, but I don't know how I can solve this.
    I managed to do this when I change at the beginning "EndRow = Range("B65536").End(xlUp).Row" into "EndRow = 1000", but I don't want that Excel is going to hide rows where there are no tasks in it (no content in column B).

    Can anyone please help me?

    Thank you all in advance.


    Edit: Is there perhaps a more simple method as my code above? And this because I have about 30 - 40 members... Thanks!
    Last edited by NMarien; 02-07-2011 at 08:27 AM. Reason: message incomplete - additional question

Thread Information

Users Browsing this Thread

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

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