1
我有3个相关矩阵:条件格式 - 的Excel VBA 2010
输入相关性:
Acc & Health AE Avemco Aviation Bail
Acc & Health 1 0.15 0.15 0.15
AE 0.15 1 0.15 0.25
Avemco Aviation 0.15 0.15 1 0.15
Bail 0.15 0.25 0.15 1
输出相关性:
Acc & Health AE Avemco Aviation Bail
Acc & Health 1
AE 0.158 1
Avemco Aviation 0.139 0.158 1
Bail 0.177 0.258 0.130 1
比较相关(的绝对值输入 - 输出相关表):
Acc & Health AE Avemco Aviation Bail
Acc & Health 0.000
AE 0.008 0.000
Avemco Aviation 0.011 0.008 0.000
Bail 0.027 0.008 0.020 0.000
如果输入相关表值大于0.2和另一个数学条件并且比较相关表中的单元格不为空,我将条件格式应用于比较相关表:
但是我仍然由于输入值大于0.2,因此可以在空白单元格(如E3(AE和Bail))中进行格式化。我如何解决这个问题,所以没有格式化的空白单元格?
我在VBA代码部分:
.Range(.Cells(5, 2), .Cells(LastRowAgg, LastColumnAgg)).Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND((('Input Correlation'!B5:AT49-'Aggregate Loss Correlation'!B5:AT49)/'Input Correlation'!B5:AT49)>=(1/3),'Input Correlation'!B5:AT49>=0.2,B5:AT49<>"" "")"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
任何帮助将不胜感激!