excel - 跨多个工作表求和时忽略隐藏工作表
问题描述
有人可以帮我解决这个问题吗?我有这个功能可以对多张纸上的单元格求和。但是,我也有一些我不想总结的隐藏表格。如何禁用我的函数从隐藏工作表中的单元格中读取值?我的代码:
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
解决方案
尝试这个。我已经添加了这部分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
推荐阅读
- python - 必须以管理员-python 运行
- node.js - 从 MongoDB 聚合函数接收的数组不可迭代
- python - python中的双重调用
- javascript - 如何使用 JS/CSS 将数字设置为 PRE
- sql - 当没有相关记录时,无法使用日期过滤器显示记录
- java - 是否可以根据实际类中的局部变量为方法调用返回模拟对象?
- python-3.x - Frozen Issue while opening an existing file
- python - BrowserMob Proxy with Python - The Browsermob-Proxy server process failed to start - Seeing Operation not permitted in server.log
- javascript - values getting duplicated when an object is pushed into array - javascript
- python-3.x - How to get temp directory in Python with a non-ascii windows username?