oblix
Board Regular
- Joined
- Mar 29, 2017
- Messages
- 183
- Office Version
- 365
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
- 2003 or older
- Platform
- Windows
- MacOS
- Mobile
- Web
Hi there
I have the following code to sort according to a custom list:
Can someone please assist to clean up this code
Thank you in advance
I have the following code to sort according to a custom list:
VBA Code:
Sub Sort_perm()
ActiveWorkbook.Worksheets("Perm Transfer").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Perm Transfer").Sort.SortFields.Add Key:=Range( _
"Q3:Q1000"), SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:= _
"Brig Gen,Col,Lt Col,Maj,Capt,CO,WO1,WO2,F Sgt,Sgt,Cpl,L Cpl,Amn,Mr,Me" _
, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Perm Transfer").Sort
.SetRange Range("O2:Z1000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("Q8").Select
End Sub
Can someone please assist to clean up this code
Thank you in advance