This is the function call:
CornerSort (newArea)
This is the function:
Public Function CornerSort(UnSorted As AreaClass) As AreaClass
Dim firstPt As PolyPoint
Dim xMx As Double
Dim xMn As Double
Dim iitem As PolyPoint
xMx = UnSorted.theCollection(1).X
xMn = UnSorted.theCollection(1).X
For Each iitem In UnSorted.theCollection
If iitem.X > xMx Then
xMx = iitem.X
End If
If iitem.X < xMn Then
xMn = iitem.X
End If
Next iitem
For Each iitem In UnSorted.theCollection
iitem.X = iitem.X - 0.5 * (xMx + xMn)
Next iitem
CornerSort = UnSorted
End Function