[CODE]
Public Sub ArraySort_String_StartPos(ByRef xArray() As String, ByVal ElementsToSort As Long, Optional ByVal StartPos As Long = 0&, Optional ByVal IgnoreCase As Boolean = True)
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xLong3 As Long
  Dim xChar1 As String
  
  ElementsToSort = ElementsToSort - 1&
  Do
    xLong1 = 3& * xLong1 + 1&
    Loop Until xLong1 > ElementsToSort
  Do
    xLong1 = xLong1 \ 3&
    For xLong2 = xLong1 + StartPos To ElementsToSort + StartPos
      xChar1 = xArray(xLong2)
      If IgnoreCase Then
        For xLong3 = xLong2 - xLong1 To StartPos Step -xLong1
          If StrComp(xArray(xLong3), xChar1, vbTextCompare) < 1 Then Exit For
          xArray(xLong3 + xLong1) = xArray(xLong3)
          Next
        Else
        For xLong3 = xLong2 - xLong1 To StartPos Step -xLong1
          If Not xArray(xLong3) > xChar1 Then Exit For
          xArray(xLong3 + xLong1) = xArray(xLong3)
          Next
        End If
      xArray(xLong3 + xLong1) = xChar1
      Next
    Loop While xLong1
  End Sub
