Create User Functions (User Formulas)

Create User Functions (User Formulas)

Hi!

My question is: �Is now possible to implement our own functions? I need my own customize formula to count how many yellow cells are in a especified range.

I opened the VBA Editor, and i wrote and saved this code below in section Macro_Modules->Macros.

Public Function countYellowCells(ByVal Range_Data As Range)

Dim c As Range
Dim Suma As Integer

countYellowCells = 0

For Each c In Range_Data
If c.Interior.ColorIndex = 6 Then
countYellowCells = countYellowCells + 1
End If
Next c

End Function














I tried to call this function from the cell "E3" (fx=countYellowCells(A3:D3)), but it does'nt work

Thanks in advance for your comments!