[CODE]
Public Sub ArraySort_CS(ByRef xArray() As String, ByVal ElementsToSort As Long)
  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 To ElementsToSort
      xChar1 = xArray(xLong2)
      For xLong3 = xLong2 - xLong1 To 0& Step -xLong1
        If Not xArray(xLong3) > xChar1 Then Exit For
        xArray(xLong3 + xLong1) = xArray(xLong3)
        Next
      xArray(xLong3 + xLong1) = xChar1
      Next
    Loop While xLong1
  End Sub
