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!
Bookmarks