|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub qs()
- Dim arr, brr, i
- With Sheet1
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .Range("x5").Resize(r, 10)
- brr = .Range("x5").Resize(r, 10)
- ReDim crr(1 To r, 1 To 10)
- For j = 1 To UBound(arr)
- For i = 1 To UBound(arr, 2)
- k = UBound(arr, 2) - 1
- For x = 1 To k
- If arr(j, x) < arr(j, x + 1) Then
- t = arr(j, x)
- arr(j, x) = arr(j, x + 1)
- arr(j, x + 1) = t
- k = k - 1
- End If
- Next
- Next
- Next j
- For j = 1 To UBound(arr)
- For i = 1 To 3
- For x = 1 To UBound(brr, 2)
- If arr(j, i) <> Empty Then
- If arr(j, i) = brr(j, x) Then
- crr(j, x) = i
- Exit For
- End If
- End If
- Next
- Next
- Next j
- .Range("n5").Resize(r, 10) = crr
- End With
- End Sub
复制代码 |
|