条件格式的错误(可能是个人公式)

时间:2015-04-15 11:37:01

标签: excel excel-2010 conditional-formatting

在Excel 2010上,我在条件格式化之后会遇到一些奇怪的错误:

在:

enter image description here

后:

enter image description here或类似(取决于......):enter image description here

没有错误就可以这样:

enter image description here

我或多或少地确定这是由我在VBA中的个人公式引起的Excel错误:

Function NumCol(plage As Range, ch As String) As Long

    'Application.Volatile

    For Each c In plage
        If c.Value = ch Then NumCol = c.Column
    Next

End Function


Function NumLig(plage As Range, ch As String) As Long

    'Application.Volatile

    For Each c In plage
        If c.Value = ch Then NumLig = c.Row
    Next

End Function

我该怎么做才能纠正这个视觉错误?

1 个答案:

答案 0 :(得分:1)

请尝试

c.HorizontalAlignment = xlCenter 
c.VerticalAlignment = xlCenter

在每个循环中。