title: WORD VBA Sort Ascending and Sort Descending
body: <p>Here is code I have that sorts the words inside an array into ascending order. I need help to change it in such a way that it will also sort the words in descending order, all in a single function. Please help. Thanks!</p>
  
  <pre><code>Function Sort_Asc(ByRef str() As String)
       Dim iLower As Integer, iUpper As Integer, iCount As Integer, Temp As String
       Dim str2 As String
             iUpper = UBound(str)
             iLower = 1
             Dim bSorted As Boolean
             bSorted = False
             Do While Not bSorted
                  bSorted = True
                  For iCount = iLower To iUpper - 1
                  str2 = StrComp(str(iCount), str(iCount + 1), vbTextCompare)
                       If str2 = 1 Then
                             Temp = str(iCount + 1)
                             str(iCount + 1) = str(iCount)
                             str(iCount) = Temp
                             bSorted = False
                       End If
                  Next iCount
               iUpper = iUpper - 1
             Loop
  End Function
  </code></pre>