有人可以帮我这个忙吗,我有这个功能可以汇总多张纸上的单元格。但是,我也有一些隐藏的表,我不想加总。如何禁用我的功能从隐藏工作表中的单元格中读取值? 我的代码:
Function AutoSum(rng As Range) As Variant
AutoSum = 0
Application.Volatile True
For Each ws In Worksheets
If Not ws Is Application.ThisCell.Parent Then
AutoSum = AutoSum + ws.Range(rng.Address)
End If
Next
End Function
答案 0 :(得分:2)
尝试一下。我已经添加了这一部分And ws.Visible = True
Function AutoSum(rng As Range) As Variant
AutoSum = 0
Application.Volatile True
For Each ws In Worksheets
If Not ws Is Application.ThisCell.Parent And ws.Visible = True Then
AutoSum = AutoSum + ws.Range(rng.Address)
End If
Next ws
End Function