'我猜一
'现在写代码主要靠猜条件,哈哈哈。
Option Explicit
Sub test()
Dim arr, i, j, t(1)
arr = Range("e3:o" & Cells(Rows.Count, "e").End(xlUp).Row)
ReDim brr(1 To UBound(arr, 1), 1 To 1)
For i = 1 To UBound(arr, 1)
If Len(arr(i, 11)) > 0 Then
t(0) = Split(arr(i, 1), ","): t(1) = Split(arr(i, 11), ","):
ReDim crr(1 To UBound(t(0)) + 1, 1 To 2)
For j = 0 To UBound(t(0))
crr(j + 1, 1) = Val(t(1)(Val(t(0)(j)) - 1))
crr(j + 1, 2) = t(0)(j)
Next
Call bsort(crr, 1)
For j = 1 To UBound(crr, 1): brr(i, 1) = brr(i, 1) & crr(j, 2) & ",": Next
brr(i, 1) = Left(brr(i, 1), Len(brr(i, 1)) - 1)
End If
Next
[b3].Resize(UBound(brr, 1)) = brr
End Sub
Function bsort(arr, key)
Dim i, j, k, t, move As Boolean
For i = LBound(arr, 1) To UBound(arr, 1) - 1
For j = LBound(arr, 1) To UBound(arr, 1) + LBound(arr, 1) - 1 - i
If arr(j, key) < arr(j + 1, key) Then
For k = LBound(arr, 2) To UBound(arr, 2)
t = arr(j, k): arr(j, k) = arr(j + 1, k): arr(j + 1, k) = t
Next
move = True
End If
Next
If Not move Then Exit For
Next
End Function |