Hi Experts,
I'm working in VB6 / VBA and I need to sort a multi-dimensional array of strings. It all works really well except that the sort is case sensitive. It puts all entries that start in caps first and all entries that start lowercase second. Can any of you please tell me how to fix the SortIt function below to make it work right?
Thanks in advance,
PatternNut
Public Sub SortIt(ByRef A() As String, ByRef nA As Long, ByVal byCol As Long, lngTotalCol)
'A = array
'nA = ubound +1
'bycol is the second variable to sort by eg (X,bycol)
Dim i As Long
Dim j As Long
Dim tempST1 As String
Dim tempST2 As String
Dim lngCountCol As Long
For i = 1 To (nA - 2)
For j = (i + 1) To (nA - 1)
If (A(j, byCol) < A(i, byCol)) Then
For lngCountCol = 0 To lngTotalCol
tempST1 = A(i, lngCountCol)
A(i, lngCountCol) = A(j, lngCountCol)
A(j, lngCountCol) = tempST1
Next lngCountCol
End If
Next j
Next i
End Sub
Start Free Trial