|
本帖最后由 mxg825 于 2011-11-24 22:06 编辑
wayy 发表于 2011-11-24 20:50
这样能否提速一点点。。
- Sub AddCor1()
- Dim i As Long
- Dim x As Long
- Dim Str As String
- Dim t
- Dim arr
- Dim 金 As Range, 木 As Range, 水 As Range, 火 As Range, 土 As Range
- t = Timer
- Application.ScreenUpdating = False
- arr = Range("AO1", [AT65536].End(xlUp))
- Set 金 = Range("AV2")
- Set 木 = Range("AW2")
- Set 水 = Range("AX2")
- Set 火 = Range("AY2")
- Set 土 = Range("AZ2")
- For i = 1 To UBound(arr)
- For x = 1 To 6
- Str = arr(i, x)
- Select Case Str
- Case "金"
- Set 金 = Union(金, Cells(i, x + 40))
- Case "木"
- Set 木 = Union(木, Cells(i, x + 40))
- Case "水"
- Set 水 = Union(水, Cells(i, x + 40))
- Case "火"
- Set 火 = Union(火, Cells(i, x + 40))
- Case "土"
- Set 土 = Union(土, Cells(i, x + 40))
- End Select
- Next
- Next
- 金.Font.ColorIndex = 44
- 木.Font.ColorIndex = 50
- 水.Font.ColorIndex = 33
- 火.Font.ColorIndex = 3
- 土.Font.ColorIndex = 16
- Application.ScreenUpdating = True
- MsgBox "用时:" & Timer - t
- End Sub
复制代码 |
|