Conditional formatting of overlapping ranges in Excel 2007 VBA - bug?

前端 未结 1 685
忘掉有多难
忘掉有多难 2021-01-21 14:37

Currently trying to help on this question - but stumbled across a very strange problem:

When trying to add conditional formatting on overlapping ranges (in VBA), Excel 2

相关标签:
1条回答
  • 2021-01-21 15:03

    I can see a problem in Produce1004() :

    A1 has 2 format conditions and A2 has 1 format condition.

    Range("A1:A2").FormatConditions.Count gives the count for A1, FormatConditions(2) doesn't exist for A2, hence the error.

    But for ProduceError9() the number of format conditions is the same for A1 and A2.

    With a little experimentation, I can explain this by deducing that the range is stored with the format condition (setting the font for [A1].FormatCondition(3) also fails). One must change the format for the range for which the format condition was defined.

    Presumably, Excel 2010 improves on this situation by splitting a format condition on the fly.

    0 讨论(0)
提交回复
热议问题