shgmp 发表于 2013-9-19 07:57
老大,在使用的过程中,又出现新的问题了,烦请您看看,谢谢啊
Sub test()
Dim d, arr, ar, s$, i&, j&, m&
Set d = CreateObject("scripting.dictionary")
arr = Range("c10", Cells(Rows.Count, "F").End(3).Offset(, 1)).Value
ReDim brr(1 To UBound(arr), 1 To 5)
ar = Array("熟练", "掌握", "了解")
For i = 1 To UBound(arr)
For j = 0 To UBound(ar)
If arr(i, 4) = ar(j) Then arr(i, 5) = j
Next
s = arr(i, 3)
If Not d.exists(s) Then
m = m + 1
d(s) = m
brr(m, 1) = arr(i, 1)
brr(m, 2) = arr(i, 2)
brr(m, 3) = arr(i, 3)
brr(m, 5) = arr(i, 5)
brr(m, 4) = ar(arr(i, 5))
Else
If brr(d(s), 5) > arr(i, 5) Then
brr(d(s), 5) = arr(i, 5)
brr(d(s), 4) = ar(arr(i, 5))
End If
End If
Next
Range("c10:f302").ClearContents
Range("c10:f302").Interior.ColorIndex = False
Cells(10, "c").Resize(m, 4) = brr
Set d = Nothing
End Sub |