返回列表 上一主題 發帖

[發問] 儲存格範圍內底色巨集如何設定

[發問] 儲存格範圍內底色巨集如何設定

百分比
53.32%
88.65%
82.81%
66.80%
72.87%
83.08%
84.21%
86.65%
90.51%
97.10%
88.06%
86.88%
98.88%
89.46%
86.27%

範圍B3:B17百分比<70%底色改為黃色

範圍B3:B17百分比>90%底色改為綠色

範圍B3:B17百分比70%<X<90%底色無顏色

請問巨集如何寫?

感激解惑此困擾問題我自己練習巨集如下
Sub Macro3()
'
' Macro3 Macro
'

'
    Range("B3:B17").Select
    Selection.FormatConditions.Delete
    Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
        Formula1:="=0.9"
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Font
        .Color = -16383844
        .TintAndShade = 0
    End With
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 13551615
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = False
    Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
        Formula1:="=0.7"
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Font
        .Color = -16752384
        .TintAndShade = 0
    End With
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 13561798
        .TintAndShade = 0
    End With
    Selection.FormatConditions(1).StopIfTrue = False
End Sub

TOP

        靜思自在 : 忘功不忘過,忘怨不忘恩。
返回列表 上一主題