'如果连续4个或4个以上,就填充
Sub tj()
Dim Rng, A, B(), i, j, k, s
Set Rng = Sheets("条件").[s1:ab1202]
A = Rng.Value
Rng.Interior.ColorIndex = 0
For j = 1 To UBound(A, 2)
For i = 3 To UBound(A)
If TypeName(A(i, j)) <> "Error" Then
If A(i, j) <> "" And A(i, j) <> 0 Then
If A(i, j) > 2 Then
s = s + 1
ReDim Preserve B(1 To s)
B(s) = i
Else
If s >= 4 Then
For k = 1 To s
Cells(B(k), j + 18).Interior.ColorIndex = 6
Next k
Erase B
End If
s = 0
End If
End If
End If
Next i
Next j
End Sub
条件格式2.rar
(88.3 KB, 下载次数: 3)