Skip to content

Instantly share code, notes, and snippets.

@Kyeongrok
Created January 20, 2018 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kyeongrok/750bebf1f8d627e9b3d9d00778fb334e to your computer and use it in GitHub Desktop.
Save Kyeongrok/750bebf1f8d627e9b3d9d00778fb334e to your computer and use it in GitHub Desktop.
Sub main_advanced_filter()
    Sheets("filter").Range("a9:d10000").ClearFormats
    Call advancedFilter
    정렬조건 = Sheets("filter").Range("b5").Value
    Call sort(정렬조건)
    
    'Sheets("report").Range("a1").Value = Sheets("filter").Range("a8").CurrentRegion
    
End Sub
Sub advancedFilter()
    Sheets("list").Range("A1").CurrentRegion.advancedFilter Action:=xlFilterCopy, _
        CriteriaRange:=Sheets("filter").Range("A1").CurrentRegion, CopyToRange:=Range( _
        "filter!Extract"), Unique:=False
End Sub
Sub sort(p정렬조건)
    ActiveWorkbook.Worksheets("filter").sort.SortFields.Clear
    ActiveWorkbook.Worksheets("filter").sort.SortFields.Add Key:=Range("B9:B47") _
        , SortOn:=xlSortOnValues, Order:=p정렬조건, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("filter").sort
        .SetRange Range("A8").CurrentRegion
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment