首页 > 解决方案 > 办公脚本中的自定义功能?

问题描述

在 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

标签: exceloffice-scripts

解决方案


目前,您无法使用 Office 脚本创建自定义函数。要在我们的规划过程中考虑此功能请求,您可以在我们的用户语音页面上添加请求。

谢谢 - Office 脚本团队


推荐阅读