Új hozzászólás Aktív témák

  • lapa

    veterán

    válasz milow #1663 üzenetére

    relatív. az alábbi a = név, b = összeg oszlopokat feltételez, fejléccel. c és d oszlopok elejébe rakja az eredményt.

    Sub top5()

    otodik = Application.WorksheetFunction.Large(Range(Cells(2, 2), Cells(65536, 2)), 5)
    j = 0
    For i = 1 To 65536
    If Cells(i, 1).Value = '''' Then
    Exit For
    Else
    If Cells(i, 2).Value >= otodik Then
    j = j + 1
    Cells(j, 3).Value = Cells(i, 1).Value
    Cells(j, 4).Value = Cells(i, 2).Value
    End If
    End If
    Next i

    Range(Cells(1, 3), Cells(j, 4)).Sort Key1:=Cells(2, 4), Order1:=xlDescending, Key1:=Cells(2, 3), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    DataOption1:=xlSortNormal

    End Sub

Új hozzászólás Aktív témák

Hirdetés