in einer Spalte stehen Projektnummern. Ich möchte nun diejenigen fünf Projektnummern ermitteln, die am häufigsten vorkommen.
Hab grad keine Idee! und bitte um Hilfe. Herzlichen Dank
Sub Finden()
Dim j As Long
Dim C As Range, rngSuch As Range
last = Cells(1048576, 1).End(xlUp).Row
Set rngSuch = Range("a2:a" & last)
j = 2
Application.ScreenUpdating = False
For Each C In rngSuch
If Not IsEmpty(C) And [p:p].Find(C, lookat:=xlWhole) Is Nothing Then
Cells(j, "P") = C
Cells(j, "Q") = Application.CountIf(rngSuch, C)
j = j + 1
End If
Next C
Range("P2:Q" & last).Sort key1:=[q1], Order1:=xlDescending, Header:=xlNo
Range("P7:Q" & last).Clear
Columns("p:q").AutoFit
Application.ScreenUpdating = True
End Sub