I thought I would try a different approach
Sub Sort3Layer()
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
.DisplayPageBreaks = False
Firstrow = .UsedRange.Cells(1).Row + 1
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Firstrow To Lastrow
With .Cells(Lrow, "B")
If Not IsError(.Value) Then
With ActiveSheet
.Sort.SortFields.Add Key:=Range( _
"B:B"), SortOn:=xlSortOnValues, Order:=xlDescending, _
CustomOrder:="OVERDUE", _
DataOption:=xlSortNormal
.Sort.Apply ' error here
End With
End If
End With
Next Lrow
End With
End Sub
It tells me the "Sort reference is not valid make sure it's within the data you want to sort and the first
sort by box isn't the same or blank"
I want to eventually sort by 3 values Overdue, Due and Almost_Due
Any help is appreciated