Sub test()
Dim R As Range, xD, n%
Set xD = CreateObject("Scripting.Dictionary")
For Each R In Range("a2:a101")
n = n + 1
If n = 5 Then
If xD.exists(Cells(1, 1).Value) Then
R.Value = xD(Cells(1, 1).Value) + 10
xD(Cells(1, 1).Value) = R: n = 0
Else
R.Value = Cells(1, 1) + 10
xD(Cells(1, 1).Value) = R: n = 0
End If
End If
Next
End Sub作者: samwang 時間: 2021-10-19 13:10