K
keith44
I am trying to do a Lotto 649 sheet which marks each number you get b
filling in the block with a fill color, and also at the end of the ro
give a count how many numbers you have.
I have tried to do this but I can only get one or the other to work.
I can't get the two formulas to work together on one sheet
Below are the formulas
Formula 1 - =CountColor($A$2,B3:K3)
Code
Function CountColor(rColor As Range, rSumRange As Range)
''''''''''''''''''''''''''''''''''''''
'Written by Ozgrid Business Applications
'www.ozgrid.com
'Counts cells based on a specified fill color.
'''''''''''''''''''''''''''''''''''''''
Dim rCell As Range
Dim iCol As Integer
Dim vResult
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = vResult + 1
End If
Next rCell
CountColor = vResult
End Function
Formula 2 -
Choose Format|Conditional Formatting
From the first dropdown, choose Formula Is
For the formula, use the CountIf function:
=COUNTIF($A$45:$K$49,B3)
Click the Format button.
Select formatting options (green pattern,), click OK
Click OK
Thanks Keit
filling in the block with a fill color, and also at the end of the ro
give a count how many numbers you have.
I have tried to do this but I can only get one or the other to work.
I can't get the two formulas to work together on one sheet
Below are the formulas
Formula 1 - =CountColor($A$2,B3:K3)
Code
Function CountColor(rColor As Range, rSumRange As Range)
''''''''''''''''''''''''''''''''''''''
'Written by Ozgrid Business Applications
'www.ozgrid.com
'Counts cells based on a specified fill color.
'''''''''''''''''''''''''''''''''''''''
Dim rCell As Range
Dim iCol As Integer
Dim vResult
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = vResult + 1
End If
Next rCell
CountColor = vResult
End Function
Formula 2 -
Choose Format|Conditional Formatting
From the first dropdown, choose Formula Is
For the formula, use the CountIf function:
=COUNTIF($A$45:$K$49,B3)
Click the Format button.
Select formatting options (green pattern,), click OK
Click OK
Thanks Keit