Methods
Apply   적용된 정렬 상태를 기준으로 범위를 정렬
 With ActiveSheet.Sort
  .SortFields.Clear
  .SortFields.Add Key:=Range("A2:A11"), Order:=xlAscending
  .SetRange Range("A1:A11")
  .Header = xlYes
  .MatchCase = False
  .Orientation = xlTopToBottom
  .SortMethod = xlPinYin
  .Apply
 End With
SetRange   정렬이 발생하는 범위를 설정
 With ActiveSheet.Sort
  .SortFields.Clear
  .SortFields.Add Key:=Range("A2:A11"), Order:=xlAscending
  .SetRange Range("A1:A11")
  .Header = xlYes
  .MatchCase = False
  .Orientation = xlTopToBottom
  .SortMethod = xlPinYin
  .Apply
 End With
--------- --------- --------- --------- --------- --------- --------- --------- --------- 
Properties
Header   헤더 정보가 포함되는지 여부를 지정
 xlGuess : 헤더가 있는 위치를 확인
 xlNo : 전체 범위를 정렬. 기본설정
 xlYes : 전체 범위를 정렬하면 안됨
 With ActiveSheet.Sort
  .SortFields.Clear
  .SortFields.Add Key:=Range("A2:A11"), Order:=xlAscending
  .SetRange Range("A1:A11")
  .Header = xlYes
  .MatchCase = False
  .Orientation = xlTopToBottom
  .SortMethod = xlPinYin
  .Apply
 End With
MatchCase = True/False   대소문자를 구분하는 정렬을 수행 하려면 True, 아니면 False
 With ActiveSheet.Sort
  .SortFields.Clear
  .SortFields.Add Key:=Range("A2:A11"), Order:=xlAscending
  .SetRange Range("A1:A11")
  .Header = xlYes
  .MatchCase = False
  .Orientation = xlTopToBottom
  .SortMethod = xlPinYin
  .Apply
 End With
Orientation   정렬 방향을 지정
 xlSortColumns : 열을 기준으로 정렬
 xlSortRows : 행을 기준으로 정렬. 기본설정
 With ActiveSheet.Sort
  .SortFields.Clear
  .SortFields.Add Key:=Range("A2:A11"), Order:=xlAscending
  .SetRange Range("A1:A11")
  .Header = xlYes
  .MatchCase = False
  .Orientation = xlTopToBottom
  .SortMethod = xlPinYin
  .Apply
 End With
SortMethod   중국어에 대한 정렬 방법을 지정
 xlPinYin : 문자에 대한 음성 중국어 정렬순서. 기본설정
 xlStroke : 각 문자의 획 수를 기준으로 정렬
 With ActiveSheet.Sort
  .SortFields.Clear
  .SortFields.Add Key:=Range("A2:A11"), Order:=xlAscending
  .SetRange Range("A1:A11")
  .Header = xlYes
  .MatchCase = False
  .Orientation = xlTopToBottom
  .SortMethod = xlPinYin
  .Apply
 End With
SortFields   정렬 정보를 포함. ∨아래 상세설명
 With ActiveSheet.Sort
  .SortFields.Clear
  .SortFields.Add Key:=Range("A2:A11"), Order:=xlAscending
  .SetRange Range("A1:A11")
  .Header = xlYes
  .MatchCase = False
  .Orientation = xlTopToBottom
  .SortMethod = xlPinYin
  .Apply
 End With

 

< SortFields >

Methods
Add <상세  정의된 데이터 형식으로 정렬함
 ActiveSheet.SortFields.Add Key:=Range("A2:A11"), SortOn:=xlSortOnValues, Order:=xlAscending
Add2 <상세  정의된 데이터 형식으로 정렬함
 ActiveSheet.SortFields.Add2 Key:=Range("A2:A11"), SortOn:=xlSortOnValues, Order:=xlAscending
Clear   모든 SortFields 개체를 지움
 ActiveSheet.Sort.SortFields.Clear
--------- --------- --------- --------- --------- --------- --------- --------- --------- 
Properties

 

 

형식
SortFields.Add(Key, SortOn, Order, CustomOrder, DataOption) <이전
지정값 구분 형식 설명
Key  Required Range  정렬에 대한 키값을 지정
SortOn  Optional XlSortOn
^클릭
 정렬할 필드
Order  Optional XlSortOrder
^클릭
 정렬 순서를 지정
CustomOrder  Optional Variant  사용자 지정 정렬 순서를 사용해야 하는지 여부를 지정
DataOption  Optional XlSortDataOption
^클릭
 데이터 옵션을 지정

 

 

형식
SortFields.Add2(Key, SortOn, Order, CustomOrder, DataOption, SubField) <이전
지정값 구분 형식 설명
Key  Required Range  정렬에 대한 키값을 지정
SortOn  Optional XlSortOn
^클릭
 정렬할 필드
Order  Optional XlSortOrder
^클릭
 정렬 순서를 지정
CustomOrder  Optional Variant  사용자 지정 정렬 순서를 사용해야 하는지 여부를 지정
DataOption  Optional XlSortDataOption
^클릭
 데이터 옵션을 지정
SubField  Optional Variant  데이터 유형(예: 지리의 경우 인구 또는 주식의 경우 볼륨)에 대해 정렬할 필드를 지정

 

출처: Microsoft/Docs/Office VBA Reference/Excel

'링크 > VBA' 카테고리의 다른 글

Application  (0) 2021.12.04
Comment  (0) 2021.12.04
Borders  (0) 2021.12.04
Font  (0) 2021.12.04
Range  (0) 2021.12.04

+ Recent posts