Triedenie adries IP - tipy pre Excel

Obsah

Russell má stĺpec interných IP adries a chce ich zoradiť. Problém je v tom, že 0,100. adresy prichádzajú pred .22. adresy.

Ak Russell pridá nový dočasný stĺpec, ktorý sa má použiť na triedenie, môže použiť túto novú vlastnú funkciu IPForSort (). Tento kód by sa mal vložiť do modulu kódu v zošite.

Public Function IPforSort(OrigVal) IPforSort = "" OrigVal = OrigVal & "." Bg = 1 For i = 1 To Len(OrigVal) If Mid(OrigVal, i, 1) = "." Then IPforSort = IPforSort & Format(Mid(OrigVal, Bg, i - Bg), "000") & "." Bg = i + 1 End If Next i IPforSort = Left(IPforSort, Len(IPforSort) - 1) End Function

Zaujímavé články...