|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%, m%
- Dim arr, brr, zrr()
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- .Range("u2:u" & r).ClearContents
- arr = .Range("a2:u" & r)
- xm = Empty
- For i = 1 To UBound(arr)
- If arr(i, 5) <> xm Then
- m = m + 1
- ReDim Preserve zrr(1 To m)
- zrr(m) = Array(i, i)
- Else
- If m > 0 Then
- zrr(m)(1) = i
- End If
- End If
- xm = arr(i, 5)
- Next
- For k = 1 To UBound(zrr)
- If zrr(k)(1) - zrr(k)(0) > 0 Then
- For i = zrr(k)(0) + 1 To zrr(k)(1)
- If arr(i, 20) <> arr(zrr(k)(0), 20) Then
- For j = zrr(k)(0) To zrr(k)(1)
- If arr(j, 18) <> arr(j, 20) Then
- arr(j, 21) = "不一致"
- End If
- Next
- Exit For
- End If
- Next
- End If
- Next
- .Range("a2:u" & r) = arr
- End With
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|