|
发表于 2013-1-2 11:46
|
显示全部楼层
本楼为最佳答案
- Sub test4()
- Dim arr, t, i&
- Dim x As Integer, x1 As Integer
- Dim st As String, at1 As String
- 清除颜色
- arr = Range("d1:d" & Range("d65536").End(xlUp).Row)
- For x = 2 To UBound(arr)
- If arr(x, 1) > 500 Then
- i = x
- Do
- x = x + 1
- If x >= UBound(arr) Then Exit Do
- Loop Until arr(x, 1) <= 500
- st1 = st
- st = st & "a" & i & ":d" & x - 1 & ","
- If Len(st) > 255 Then
- st = st1
- Range(Left(st, Len(st) - 1)).Interior.ColorIndex = 3
- x = x - 1
- st = ""
- End If
- End If
- Next x
- If x >= UBound(arr) And st <> "" Then Range(Left(st, Len(st) - 1)).Interior.ColorIndex = 3
- End Sub
复制代码 |
|