Hi All,
Workbook 1 has the following information: 20 Rows each row has a unique heading in Column “A”. 30 Column’s each cell in this range will have a fill color. Range “A23:A29” are the colors defined. The following function works great for tallying each Column by color:
=CountByColor(B1:B6,A23)
Function CountColor(InputRange As Range, ColorRange As Range) As Double
Dim cl As Range, TempCount As Double, ColorIndex As Integer
Application.Volatile
ColorIndex = ColorRange.Cells(1, 1).Interior.ColorIndex
TempCount = 0
On Error Resume Next
For Each cl In InputRange.Cells
If cl.Interior.ColorIndex = ColorIndex Then TempCount = TempCount + 1
Next cl
On Error GoTo 0
Set cl = Nothing
CountByColor = TempCount
End Function
The questions, In Workbook 2 starting in Cell C1 list by heading in Workbook 1 cells “A1:A20” of all that’s applicably by color
-----------------
Workbook 1
AB Blue
BB Red
CB Green
DB White
EB Blue
FB Blue
Blue = 3
------------------
Workbook 2
Blue
AB
EB
FB
Thanks in advance for all the help the board has provided
Workbook 1 has the following information: 20 Rows each row has a unique heading in Column “A”. 30 Column’s each cell in this range will have a fill color. Range “A23:A29” are the colors defined. The following function works great for tallying each Column by color:
=CountByColor(B1:B6,A23)
Function CountColor(InputRange As Range, ColorRange As Range) As Double
Dim cl As Range, TempCount As Double, ColorIndex As Integer
Application.Volatile
ColorIndex = ColorRange.Cells(1, 1).Interior.ColorIndex
TempCount = 0
On Error Resume Next
For Each cl In InputRange.Cells
If cl.Interior.ColorIndex = ColorIndex Then TempCount = TempCount + 1
Next cl
On Error GoTo 0
Set cl = Nothing
CountByColor = TempCount
End Function
The questions, In Workbook 2 starting in Cell C1 list by heading in Workbook 1 cells “A1:A20” of all that’s applicably by color
-----------------
Workbook 1
AB Blue
BB Red
CB Green
DB White
EB Blue
FB Blue
Blue = 3
------------------
Workbook 2
Blue
AB
EB
FB
Thanks in advance for all the help the board has provided