|
楼主 |
发表于 2018-7-18 12:37
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 cgx5871 于 2018-7-18 12:39 编辑
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Dim rng As Range
- Application.EnableEvents = False
- Set rng = Target.SpecialCells(xlCellTypeVisible)
- Application.EnableEvents = True
- Call MySum(rng)
- End Sub
复制代码- Public Function MySum(rng As Range) As Double
- Dim Arr
- Dim Tmp As Double
- Dim i As Long, j As Long
- Arr = rng
-
- For i = 1 To UBound(Arr)
- Tmp = 1
- For j = 1 To UBound(Arr, 2)
- Tmp = Tmp * Arr(i, j)
- Next j
- MySum = MySum + Tmp
- Next i
- End Function
复制代码
测试了一下, 会出错.
增加一项, 筛选后的可见单元格计算.
附件已重新上传, 求帮助.==========
如果用Area, 分别取出, 再用SumProduct计算, 会不会更方便一点?
|
|