Partial list needed

Occasional Visitor



I have a list with the general work population and their qualifications. I need to filter the data on separate pages according to department. A pivot doesn't meet requirements.

I need something in the lines of : if the department is called "A" the data is copied to the page called Department A. I have seven departments to account for.

The general data is something along "Dep / Name / First name / qualification a / qualification b"

If possible I would prefer an answer in German as my setup is German.



1 Reply


Sub department()

Dim i As Long
Dim k As Long
Dim l As Long

l = Range("A" & Rows.Count).End(xlUp).Row

For i = 2 To l

k = Worksheets("Department " & Cells(i, 1).Value).Range("A" & Rows.Count).End(xlUp).Row
Range(Cells(i, 1), Cells(i, 5)).Copy Destination:=Worksheets("Department " & Cells(i, 1).Value).Cells(k + 1, 1)

Next i

End Sub

Maybe with this code. In the attached file you can click the button in cell H2 to run the macro.