본문으로 바로가기

excel vba 정렬

category Excel VBA/VBA 예제 2018.09.19 20:44


Sub 정렬()
    Range("a8").CurrentRegion.Sort key1:=Range("G9"), order1:=xlAscending, _
    key2:=Range("H9"), order2:=xlAscending, _
    key3:=Range("R9"), order3:=xlAscending, Header:=xlYes
End Sub

1
2
3
4
5
6
7
8
9
10
11
12
13
Sub 정렬()
    Worksheets("filter").Sort.SortFields.Clear
    Worksheets("filter").Sort.SortFields.Add2 Key:=Range("H9"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("filter").Sort
        .SetRange Range("A9").CurrentRegion
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub
cs



댓글을 달아 주세요