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 2007 produces Error 1004 or or Error 9 (Subscript out of range) errors. I managed to boil the erroneous code down to this:
Sub Produce1004()
Cells.FormatConditions.Delete
Range("A1").FormatConditions.Add Type:=xlExpression, Formula1:="=1"
Range("A1:A2").FormatConditions.Add Type:=xlExpression, Formula1:="=1"
Range("A1:A2").FormatConditions(Range("A1:A2").FormatConditions.Count).Font.ColorIndex = 7
サブ終了
サブ ProduceError9()
Cells.FormatConditions.Delete
Range("A1:A3").FormatConditions.Add Type:=2, Formula1:="=1"
Range("A1:A2").FormatConditions.Add Type:=2, Formula1:="=1"
Range("A1:A2").FormatConditions.Add Type:=2, Formula1:="=1"
Range("A1:A2").FormatConditions(Range("A1:A2").FormatConditions.Count).Font.ColorIndex = 3
サブ終了
エラーが発生するのは、両方のサブルーチンの最後の行です。このエラーは Excel 2007 でのみ発生し、2010 では問題なく動作します。
誰かが回避策を知っていますか?