Philip1957
Board Regular
- Joined
- Sep 30, 2014
- Messages
- 185
- Office Version
- 365
- Platform
- Windows
Greetings,
This is my first attempt at a UDF. I have the following saved to MyFunctions.xlam and the add-in is active in all of my workbooks.
The function shows up when I start typing in a cell ...
... but it gives me a #NAME error and I don't understand why.
What am I doing wrong?
Any assistance would be greatly appreciated.
Thank you,
~ Phil
This is my first attempt at a UDF. I have the following saved to MyFunctions.xlam and the add-in is active in all of my workbooks.
VBA Code:
Function CountCcolor(range_data As Range, criteria As Range) As Long
Dim datax As Range
Dim xcolor As Long
xcolor = criteria.Interior.ColorIndex
For Each datax In range_data
If datax.Interior.ColorIndex = xcolor Then
CountCcolor = CountCcolor + 1
End If
Next datax
End Function
The function shows up when I start typing in a cell ...
... but it gives me a #NAME error and I don't understand why.
What am I doing wrong?
Any assistance would be greatly appreciated.
Thank you,
~ Phil