|
楼主 |
发表于 2010-12-9 22:58
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
RANGE区域中的地址,字符限制好象是255!?加了判断又影响速度!老师看看怎么办?谢谢先!- Sub MyColor()
- Dim i#, n#, MyStrA$, MyStrB$, Arr, Rng, T As Date
- T = Timer
- Arr = Range("a1:a100000")
- For i = 1 To 100000
- If Arr(i, 1) < 60 Then
- If Len(MyStrA) + Len(i) + 2 < 256 Then
- MyStrA = MyStrA & MyStrB & "," & "A" & i
- MyStrB = ""
- Else
- MyStrB = "," & "A" & i
- Set Rng = Range(Mid(MyStrA, 2))
- Rng.Interior.ColorIndex = 3
- MyStrA = ""
- Set Rng = Nothing
- End If
- End If
- Next i
- MsgBox "运行时间:" & Format(Timer - T, "0.00") & "秒。"
- End Sub
复制代码 |
|