vba 我用下面的代碼在Excel細胞插入條件格式..如何有條件地格式化Excel VBA宏?
range("d" & rowno).Select
Selection.Offset(1, 0).EntireRow.Insert
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="= RC > 7"
Selection.FormatConditions(Selection.FormatConditions.count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535 'Yellow
.TintAndShade = 0
End With
上面通過比較所定義比值磨碎這是「7」工作正常... 但是,如果我通過變量「lhigh」存儲值,同樣的im將它傳遞給formaula它不起作用。 例如; lhigh=7
range("d" & rowno).Select
Selection.Offset(1, 0).EntireRow.Insert
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="= RC > lhigh"
Selection.FormatConditions(Selection.FormatConditions.count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535 'Yellow
.TintAndShade = 0
End With
請讓我知道我們如何能夠比計算大於檢查,如果我們通過變量,而不是直接的整數值
謝謝..它的工作原理 – user930679