|
代码如下。。。
Sub test()
With Sheet1
r = .Cells(Rows.Count, 5).End(3).Row
.[m6].Resize(r - 5).ClearContents
ReDim brr(1 To 10000, 1 To 2)
n = 0: m = 0
For i = 6 To r - 1
If .Cells(i, 5).Interior.Color = .Cells(i + 1, 5).Interior.Color Then
If .Cells(i, 5) <> 0 And n = 0 Then
m = m + 1
brr(m, 1) = "第" & i & "行": brr(m, 2) = "少0"
ElseIf .Cells(i + 1, 5) <> .Cells(i, 5) + 1 Then
m = m + 1
brr(m, 1) = "第" & i + 1 & "行": brr(m, 2) = "不连续"
End If
If n = 0 And .Cells(i + 1, 5) <> .Cells(i, 5) + 1 Then
m = m + 1
brr(m, 1) = "第" & i + 1 & "行": brr(m, 2) = "不连续"
End If
n = n + 1
Else
n = 0
End If
Next
.[t6].Resize(m, 2) = brr
End With
Beep
End Sub
|
|