我在excel的VBA中定义了一个颜色求和函数的模块,如下:{
Function SumColor(sumrange As Range, col As Range)
Dim rng As Range
For Each rng In sumrange
If rng.Interior.ColorIndex = col.Interior.ColorIndex Then
SumColor = Application.Sum(rng) + SumColor
End If
Next rng
End Function
}
但是在实际操作过程中,每一次增加颜色单元格时,=SumColor()里面的数字并不会自动改变,点击计算全部也没用,必须要把这个=SumColor()点开编辑再回车,数字才会变化。
因为数据比较多,经常会出现更改,但是每次都要把所有求和的单元格重新拉一边....就工程量很大。
求大佬帮助~有没有办法可以实时更新数据啊
Function SumColor(sumrange As Range, col As Range)
Dim rng As Range
For Each rng In sumrange
If rng.Interior.ColorIndex = col.Interior.ColorIndex Then
SumColor = Application.Sum(rng) + SumColor
End If
Next rng
End Function
}
但是在实际操作过程中,每一次增加颜色单元格时,=SumColor()里面的数字并不会自动改变,点击计算全部也没用,必须要把这个=SumColor()点开编辑再回车,数字才会变化。
因为数据比较多,经常会出现更改,但是每次都要把所有求和的单元格重新拉一边....就工程量很大。
求大佬帮助~有没有办法可以实时更新数据啊