[vba] [vba] 조건부 서식이 걸린 셀 Display 색상 가져오기
하나를하더라도최선을
2020-09-08 01:43
4,937
0
본문
조건부 서식이 걸린 셀의 색상을 카운트할 수 있습니다.
아래처럼 [알고자 하는 셀].DisplayFormat.Interior.Color로 조건부 서식으로 지정한 셀 색상 값을 가져올 수 있습니다.
dColor = rasCell.DisplayFormat.Interior.Color
Function Color(intRng As Range) As String
Dim rasCell As Range
Dim Y As Integer
Dim R As Integer
Dim G As Integer
Dim dColor As Long
For Each rasCell In intRng
If rasCell.FormatConditions.Count > 0 Then
dColor = rasCell.DisplayFormat.Interior.Color
If dColor = RGB(255, 255, 0) Then
Y = Y + 1
ElseIf dColor = RGB(255, 0, 0) Then
R = R + 1
ElseIf dColor = RGB(84, 130, 53) Then
G = G + 1
End If
End If
Next
Color = Y & R & G
End Function
댓글목록0