Hi everyone! I am experiencing a #VALUE error when clearing a range of cells using a submodule. I do not get the error when I select the range with my mouse and right click "Clear Contents". Any help would be appreciated! Here is my code:

Clearing Range
Sub Macro1()

With Worksheets("Sep")

    .Range("A9:A13").ClearContents

End With
End Sub
Here is the formula that is throwing #VALUE error

=CountCcolor(Oct!A9:A134,AD1)
Here is the function I am using to count red cells

Public Function CountCcolor(ByRef range_data As Range, ByRef 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