현재 on this question를 도와 주려고 -하지만 아주 이상한 문제를 우연히 발견 :Excel 2007 VBA에서 겹치는 범위의 조건부 서식 - 버그?
(VBA에서) 범위 중복에 조건부 서식을 추가하려고, 엑셀 2007 (범위를 벗어난 첨자) 오류 1004 또는 오류 9를 생산하는 오류 . 나는이 오류 코드를 다음과 같이 끓여 냈다 :
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 End Sub Sub 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 End Sub
오류를 일으키는 두 줄의 마지막 줄이다. 이 오류는 Excel 2007에서만 발생하며 2010 년에 정상적으로 실행됩니다.
해결 방법을 알고 있습니까?
VBA가 Office 2010 용으로 다시 작성되었으므로 그 차이점을 설명 할 수 있습니다. FormatConditions.Item (...)을 대신 사용해 보셨습니까? –
Peter, Excel 2007의 버그라고 생각합니다. 이미 테스트를 수행했습니다. 그러나, 나는 2010 년에이 물건을 추가적으로 병렬로 점검 할 필요가있다. 추측이 아닌 사실을 알게 되 자마자 돌아갑니다.) –
이 호에 대한 더 많은 아이디어는 없습니까? 4 년 후 나의 작업 환경은 Excel 2007을 사용하여 _still_이며,이 버그도 나에게 부딪혔다. 질문보기 : http://stackoverflow.com/q/43463037/2084052 –