I have this Custom Sort code in my macro but whenever it does the sort (which it completes successfully) when I go to save the file Excel just crashes out with no error message - why is this so?
Code:
'This bit sorts the OpenIssues according to CustomSort List
'Deletes any Custom Lists already installed
For x = Application.CustomListCount To 5 Step -1
Application.DeleteCustomList (x)
Next x
' custom sort order text
Application.AddCustomList ListArray:=Sheets("Validations").Range("CustomSort")
' sort using latest custom sort order entry
Range("a7:l" & LR).Sort Key1:=Range("G6"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=Application.CustomListCount + 1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
' remove latest custom sort entry order
Application.DeleteCustomList Application.CustomListCount
Application.EnableEvents = True
End Sub