- 帖子
- 172
- 主題
- 39
- 精華
- 20
- 積分
- 177
- 點名
- 0
- 作業系統
- Microsoft Windows XP
- 軟體版本
- Microsoft Office 2003
- 閱讀權限
- 100
- 性別
- 男
- 來自
- 高雄
- 註冊時間
- 2010-5-1
- 最後登錄
- 2023-3-19
 
|
模組化呢 試試看!
Function SetCellInfo(ByVal fCell As Variant, ByVal iColorIndex As Integer, ByVal fColorIndex As Integer, ByVal fBold As Boolean)
fCell.Interior.ColorIndex = iColorIndex '
fCell.Font.ColorIndex = fColorIndex
fCell.Font.Bold = fBold
End Function
'Dim Rng As Range 這個變數是多餘的!
Dim F As Variant
For Each F In ThisWorkbook.Sheets("sheet2").[b4:i15]
If F > 800 Then
Call SetCellInfo(F, 40, 3, True)
ElseIf F > 500 And F <= 800 Then
Call SetCellInfo(F, 36, 3, True)
ElseIf F > 200 And F <= 500 Then
Call SetCellInfo(F, 19, 3, True)
ElseIf F < -200 And F >= -500 Then
Call SetCellInfo(F, 24, 11, True)
ElseIf F < -500 And F >= -800 Then
Call SetCellInfo(F, 15, 11, True)
ElseIf F < -800 Then
Call SetCellInfo(F, 48, 11, True)
Else
Call SetCellInfo(F, 35, 1, False)
End If
Next F |
|