비고
범위에 대해 3 개 이상의 조건부 서식을 정의 할 수 없습니다. Modify 메서드를 사용하여 기존 조건부 서식을 수정하거나 Delete 메서드를 사용하여 새 형식을 추가하기 전에 기존 형식을 삭제합니다.
통사론:
FormatConditions.Add(Type, Operator, Formula1, Formula2)
매개 변수 :
| 이름 | 필수 / 선택 사항 | 데이터 형식 |
|---|
| 유형 | 필수 | XlFormatConditionType |
| 운영자 | 선택 과목 | 다른 |
| 포뮬러 1 | 선택 과목 | 다른 |
| 포뮬러 2 | 선택 과목 | 다른 |
| 이름 | 기술 |
|---|
| xlAboveAverageCondition | 평균 이상 |
| xlBlanksCondition | 블랭크 상태 |
| xlCellValue | 셀 값 |
| xlColorScale | 색 눈금 |
| xl 다다바르 | Databar |
| xlErrorsCondition | 오류 조건 |
| xl 표현 | 표현 |
| XlIconSet | 아이콘이 설정되었습니다. |
| xlNoBlanksCondition | 공백 조건 없음 |
| xlNoErrorsCondition | 오류 조건 없음 |
| xlTextString | 텍스트 문자열 |
| xl 시간주기 | 기간 |
| xlTop10 | 상위 10 개 값 |
| xl 유니크 값 | 고유 값 |
셀 값별 서식 지정 :
With Range("A1").FormatConditions.Add(xlCellValue, xlGreater, "=100")
With .Font
.Bold = True
.ColorIndex = 3
End With
End With
운영자 :
| 이름 |
|---|
| xlBetween |
| xlEqual |
| xlGreater |
| xlGreaterEqual |
| xlLess |
| xlLessEqual |
| xlNotBetween |
| xlNotEqual |
Type이 xlExpression이면 Operator 인수는 무시됩니다.
텍스트 형식화에는 다음이 포함됩니다.
With Range("a1:a10").FormatConditions.Add(xlTextString, TextOperator:=xlContains, String:="egg")
With .Font
.Bold = True
.ColorIndex = 3
End With
End With
운영자 :
| 이름 | 기술 |
|---|
| xlBeginsWith | 지정된 값으로 시작합니다. |
| xl 포함 | 지정된 값을 포함합니다. |
| xlDoesNotContain | 지정된 값을 포함하지 않습니다. |
| xlEndsWith | 지정한 값 끝내기 |
기간별 서식 지정
With Range("a1:a10").FormatConditions.Add(xlTimePeriod, DateOperator:=xlToday)
With .Font
.Bold = True
.ColorIndex = 3
End With
End With
운영자 :
| 이름 |
|---|
| 어제 |
| 내일은 |
| xlLast7Days |
| xlLastWeek |
| 이 주간 xl |
| xlNextWeek |
| xlLastMonth |
| xlThisMonth |
| xlNextMonth |
조건부 형식 제거
범위에서 모든 조건부 서식 제거 :
Range("A1:A10").FormatConditions.Delete
워크 시트에서 모든 조건부 서식 제거 :
Cells.FormatConditions.Delete
중복 값 강조 표시
With Range("E1:E100").FormatConditions.AddUniqueValues
.DupeUnique = xlDuplicate
With .Font
.Bold = True
.ColorIndex = 3
End With
End With
고유 값 강조 표시
With Range("E1:E100").FormatConditions.AddUniqueValues
With .Font
.Bold = True
.ColorIndex = 3
End With
End With
상위 5 개 값 강조 표시
With Range("E1:E100").FormatConditions.AddTop10
.TopBottom = xlTop10Top
.Rank = 5
.Percent = False
With .Font
.Bold = True
.ColorIndex = 3
End With
End With
With Range("E1:E100").FormatConditions.AddAboveAverage
.AboveBelow = xlAboveAverage
With .Font
.Bold = True
.ColorIndex = 3
End With
End With
운영자 :
| 이름 | 기술 |
|---|
| XlAboveAverage | 평균 이상 |
| XlAboveStdDev | 표준 편차 초과 |
| XlBelowAverage | 평균 이하 |
| XlBelowStdDev | 표준 편차 이하 |
| XlEqualAboveAverage | 평균 이상 |
| XlEqualBelowAverage | 평균 이하 |
Range("a1:a10").FormatConditions.AddIconSetCondition
With Selection.FormatConditions(1)
.ReverseOrder = False
.ShowIconOnly = False
.IconSet = ActiveWorkbook.IconSets(xl3Arrows)
End With
With Selection.FormatConditions(1).IconCriteria(2)
.Type = xlConditionValuePercent
.Value = 33
.Operator = 7
End With
With Selection.FormatConditions(1).IconCriteria(3)
.Type = xlConditionValuePercent
.Value = 67
.Operator = 7
End With
IconSet :
| 이름 |
|---|
| xl3Arrows |
| xl3ArrowsGray |
| xl3 플래그 |
| xl3 서명 |
| xl3Stars |
| xl3 심볼 |
| xl3 심볼 2 |
| xl3TrafficLights1 |
| xl3TrafficLights2 |
| xl3 삼각형 |
| xl4Arrows |
| xl4ArrowsGray |
| xl4CRV |
| xl4RedToBlack |
| xl4 교통 정보 |
| xl5Arrows |
| xl5ArrowsGray |
| xl5Boxes |
| xl5CRV |
| xl5 쿼터스 |
유형:
| 이름 |
|---|
| xlConditionValuePercent |
| xlConditionValueNumber |
| xlConditionValuePercentile |
| xlConditionValueFormula |
운영자:
| 이름 | 값 |
|---|
| xlGreater | 5 |
| xlGreaterEqual | 7 |
값:
아이콘의 임계 값을 조건부 형식으로 반환하거나 설정합니다.