|
写法换了下。
- Sub ykcbf() '//2024.3.19
- Dim arr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- b = [{1,2,4,5,3}]
- m = 0
- With Sheets("表一")
- r = .Cells(.Rows.Count, "f").End(xlUp).Row
- arr = .Range("f8:p" & r)
- ReDim brr(1 To 1000, 1 To 6)
- For i = 2 To UBound(arr)
- s = arr(i, 5)
- If arr(i, 6) & arr(i, 7) & arr(i, 9) & arr(i, 11) = Empty Then
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- brr(m, 1) = m
- For j = 2 To UBound(b)
- brr(m, j) = arr(i, b(j))
- Next
- brr(m, 6) = 1
- Else
- r = d(s)
- brr(r, 6) = brr(r, 6) + 1
- End If
- End If
- Next
- End With
- With Sheets("表二")
- .[j8].Resize(1000, 6) = ""
- .[j8].Resize(m, 6) = brr
- .[j8].Resize(m, 6).Borders.LineStyle = 1
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|