- Sub 测试() ''答题专用套路--by:学习使我快乐
- Dim i, j, k, m, n, arr, brr, crr, drr
- Dim sht As Worksheet, wbk As Workbook, rng As Range
- Dim dic As Object, key As String, keys, items
- Set dic = CreateObject("scripting.dictionary")
- arr = Sheet4.Range("A1:A" & Sheet1.Cells(Rows.Count, "A").End(xlUp).Row).Value
- For i = 2 To UBound(arr)
- key = arr(i, 1)
- dic(key) = ""
- Next
- ReDim crr(1 To 100)
- For i = 2 To Sheet5.Cells(Rows.Count, "A").End(xlUp).Row
- brr = Split(Cells(i, 1), ",")
- k = 0
- For j = 0 To UBound(brr)
- key = brr(j)
- If Not dic.Exists(key) Then
- k = k + 1
- crr(k) = key
- End If
- Next
- For j = 1 To k
- Sheet5.Cells(i, 3) = Mid(Sheet5.Cells(i, 5) & "," & brr(k), 2)
- Next
- Next
- End Sub
复制代码 |