在 Excel VBA 中,我创建了以下自定义函数。是否可以在 Excel 脚本中复制它?
Function ColorSum(myrange As Range, mycolorindex As Integer) As Double
Dim c As Range
On Error Resume Next
For Each c In myrange.Cells
If c.Interior.ColorIndex = mycolorindex Then _
ColorSum = ColorSum + c.Value
Next
End Function