Forum Discussion

cwarne1305's avatar
cwarne1305
Copper Contributor
Apr 22, 2025

Filter list based on another cell

Creating a project timesheet where employees input their hours each week for each project so we can appropriately charge the client. I need it to function so when the employee selects their name in the validation drop down list it automatically filters out everyone else's project hours for that week. 

E.g. They would select their initials in cell C2 and it would automatically hide all the rows and only show the corresponding rows for the selected employee. So for employee "FC" it would go from looking like this...

To this...

Alternatively, if there is a far easier way of doing this would love the advice.

Thank you

1 Reply

  • Are you considering VBA:

     

    Sub FilterRowsByInitials()
        Dim ws As Worksheet
        Dim lastRow As Long
        Dim initials As String
        Dim i As Integer
    
        Set ws = ThisWorkbook.Sheets("YourSheetName") ' Change to your sheet name
        initials = ws.Range("C2").Value ' Cell with dropdown
        lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row ' Change column as needed
    
        For i = 2 To lastRow ' Assuming headers are in row 1
            If ws.Cells(i, "A").Value <> initials Then ' Change column "A" to your Initials column
                ws.Rows(i).EntireRow.Hidden = True
            Else
                ws.Rows(i).EntireRow.Hidden = False
            End If
        Next i
    End Sub