vba 我使用下面的代码在 excel 单元格中插入条件格式..
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”,并且在公式中传递它,它不起作用。例如;
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
请让我知道我们如何计算大于检查我们是否传递变量而不是直接整数值