This is the macro I run via a button
Sub STATUS_SORT()
Dim oWorksheet As Worksheet
Set oWorksheet = ActiveWorkbook.Worksheets("To-Do List Dan B-H")
Dim oRangeSort As Range
Dim oRangeKey As Range
' one range that includes all colums do sort
Set oRangeSort = oWorksheet.Range("C3:C33")
' start of column with keys to sort
Set oRangeKey = oWorksheet.Range("C3")
' custom sort order
Dim sCustomList(1 To 5) As String
sCustomList(1) = "IN PROGRESS"
sCustomList(2) = "ON HOLD"
sCustomList(3) = "NOT STARTED"
sCustomList(4) = "ONGOING"
sCustomList(5) = "COMPLETE"
Application.AddCustomList ListArray:=sCustomList
oWorksheet.Sort.SortFields.Clear
oRangeSort.Sort Key1:=oRangeKey, Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=Application.CustomListCount + 1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
' clean up
Application.DeleteCustomList Application.CustomListCount
Set oWorksheet = Nothing
Set oRangeSort = Nothing
Set oRangeKey = Nothing
End Sub
I can save the file fine until I run the macro, then the program crashes when it auto saves or I save it.
Office 2013
Windows 8.1 Pro
Bookmarks