I am using this function into cell F2 and i am seeing the #VALUE in F2
Function Catalogcount(CatalogRange As Range, RangetoCheck As Range)
Dim catalog As Integer
Dim counter As Integer
Dim index As Integer
Dim text As String
Application.Volatile
counter = 0
index = 21
Worksheets("Austin Site Tracker").Range("A21:A40").Clear
For catalog = 1 To RangetoCheck.count
If WorksheetFunction.CountIf(CatalogRange, CatalogRange.Cells(catalog, 1)) <> 1 Then ' if catalog number is not unique, then check nonolist
If WorksheetFunction.CountIf(Worksheets("Austin Site Tracker").Range("A21:A40"), CatalogRange.Cells(catalog, 1)) > 0 Then ' if catalog number is present, then skip this one
' skipping
Else ' else add it to nonolist and run main sub
Worksheets("Austin Site Tracker").Range("A" & index).Value = CatalogRange.Cells(catalog, 1).Value
index = index + 1
'
If RangetoCheck.Cells(catalog, 1).Interior.Color <> 16777215 Then ' the cell had color so increment counter
counter = counter + 1
End If
'
End If
Else ' else since it is unique, run main sub
'
If RangetoCheck.Cells(catalog, 1).Interior.Color <> 16777215 Then ' the cell had color so increment counter
counter = counter + 1
End If
'
End If
Next catalog
Worksheets("Austin Site Tracker").Range("A21:A40").Clear 'clean up
Catalogcount = counter
End Function
Bookmarks