1
這裏是我有的代碼,按升序排列數組中的單詞。我需要幫助來改變它,以便它還將以單一功能降序排列單詞。請幫忙。謝謝!WORD VBA按升序排序和降序排列
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
感謝功能得到這個一個工作。感謝那裏的朋友! – decrementor 2011-04-30 07:33:36