【发布时间】:2023-02-03 00:50:33
【问题描述】:
我正在尝试转换一个代码,它在 VBA 中按颜色生成单元格总和,但我需要使用与 Office 脚本中的代码相同的代码或操作,我不知道这个平台的结构如何,也许,你能帮我做吗?
VBA中的代码是这样的:代码
Function SumByColor(Cellcolor As Range, RangeSum As Range) As Double
Dim cell As Range
For Each cell In RangeSum
If celda.Interior.ColorIndex = Celdacolor.Cells(1, 1).Interior.ColorIndex Then SumByColor = SumByColor+ cell
Next cell
Set cell = Nothing
End Function
所以我需要在办公脚本中使用这段代码
【问题讨论】:
-
我没有使用 office 脚本的经验,但这是获取单元格颜色的方法:LINK
-
Office 脚本目前不支持函数。所以你不能写一个函数来做这个。
标签: excel vba office-scripts